How to fix my document locale in batch?
For unknown historical reason, my documents stored in XWiki is mixed of “”, “zh” and “zh_cn”.
But the solr search plugin have a hidden rule:
- {!tag=locale}locale:(“zh_CN” OR “”)
So, a lot of my pages can not be searched out.
How can I fix it?
Is there a way to modify page locale in batch or modify the rule of Solr plugin?
BTW: my localization setting of XWiki is:
Thanks, but your page is 404 not found now
I am trying to use FarmTools / Default Language Updater to modify all my pages to “zh_CN”.
But some pages can not be found by it.
For example:
{
"id":"xwiki:AppSearch_RD.相关资料_zh",
"hidden":false,
"wiki":"xwiki",
"name":"相关资料",
"space":"AppSearch_RD",
"spaces":["AppSearch_RD"],
"locale":"zh",
"language":"zh",
"type":"DOCUMENT",
"fullname":"AppSearch_RD.相关资料",
"title_zh":["相关资料"],
"title_":"相关资料",
"doccontentraw_zh":["[[论文.rar>>attach:论文.rar]]"],
"doccontentraw_":"[[论文.rar>>attach:论文.rar]]",
"doccontent_zh":["论文.rar"],
"doccontent_":"论文.rar",
"version":"2.1",
"doclocale":"",
"locales":["",
"zh_CN",
"zh",
"en"],
"lang":["",
"zh_CN",
"zh",
"en"],
"author":"xwiki:XWiki.superadmin",
"author_display":"superadmin",
"creator":"xwiki:XWiki.superadmin",
"creator_display":"superadmin",
"creationdate":"2018-02-28T07:31:37Z",
"date":"2018-02-28T07:43:20Z",
"filename":["论文.rar"],
"mimetype":["application/x-rar-compressed"],
"attdate":["2019-12-02T14:11:17Z"],
"attsize":[333144215],
"attauthor":["xwiki:XWiki.superadmin"],
"attauthor_display":["superadmin"],
"_version_":1659477389551337472,
"attcontent_zh":["..."],
"score":16.102478
}
A very strange problem.
The locale attribute of document in XWiki and Solr are different.
“AppSearch_RD.相关资料” in XWiki, ( locale=, language=, defaultLanguage=zh_CN )
But in Solr view, is ( locale=zh, language=zh).
I think this is one reason why I can not search out these documents.
amadis
6
Hi @mflorea ! Yes, you provided link to unexistent page.
mflorea
7
@amadis I removed the snippet because I realized afterwards that it wasn’t working properly. You should try instead https://extensions.xwiki.org/xwiki/bin/view/Extension/Farm%20Default%20Language%20Updater/ .
Finally, I took mysql to resolve the pages.
update wikidocs set XWD_DEFAULT_LANGUAGE=“zh_CN’” where XWD_DEFAULT_LANGUAGE=“zh” and XWD_LANGUAGE="";