Using examine in a multiple multilingual site setup
I have this setup :
SiteA - FR - EN
SiteB - FR - EN
And I'm trying to find documentation on how to define the Examin indexes so that I have 4 seperate indexes in this scenario. That way my razor search page could select the appropriate search index to run the search query.
We've created one index per site/language so 4 indexes in your case, each index uses the proper Lucene Analyzer (ie french analyzer for the french section). And on the (razor) search page we pick the right index depending on the site/language. Works quite well.
For another setup we're currently trying to setup only one index per language and index everything in each index, then tweak the query to fetch documents under the proper root node only. It gives bigger indexes _but_ if you start having many sites, you don't have to create new indexes each time. Only if a new language comes up.
Great news (I was hooking up in the back end API node event to specify language hehe) so how can I "split" these indexes. Here is what I currently have.
In my ExamineSettings.config, for examine index providers:
var s = Request.QueryString["s"];
if (!string.IsNullOrEmpty(s))
{
var searcher = ExamineManager.Instance.SearchProviderCollection["HomeNodeSearcher"];
var criteria = searcher.CreateSearchCriteria(BooleanOperation.Or);
var filter = criteria.GroupedOr(new string[] {"nodeName", "texte", "title", "nodeTypeAlias"}, s).Not().Field("umbracoNaviHide", "1").Compile();
var results = searcher.Search(filter); }
Now I can easily identify my current language there and use another searcher, my problem is that I don't know how to specify that this searcher would use an index that would start it's index not from site root but from my specified language node. How did you specify that?
Ohh silly me I could have tried it, I thought the IndexParentId would be very specify and index only children (which makes no sense). So it's behavior is actually like IndexAncertorId and it indexes descendants, from that point. Ok I'll try it right away!
Depends. If you're willing to rebuild Examine with Lucene 2.4.9g (latest) then I *think* there's an out-of-the-box french analyzer.
If you want to stick with stock Examine then you'll have to create your own french analyser I'm afraid. We have one, though, that I believe I could share. Does accents, stemming, stopwords, stuff like that.
Using examine in a multiple multilingual site setup
I have this setup :
SiteA
- FR
- EN
SiteB
- FR
- EN
And I'm trying to find documentation on how to define the Examin indexes so that I have 4 seperate indexes in this scenario. That way my razor search page could select the appropriate search index to run the search query.
Anyone has done that before?
Thanks a bunch!
Sébastien Richer
Yes. Multiple sites, multiple languages.
We've created one index per site/language so 4 indexes in your case, each index uses the proper Lucene Analyzer (ie french analyzer for the french section). And on the (razor) search page we pick the right index depending on the site/language. Works quite well.
For another setup we're currently trying to setup only one index per language and index everything in each index, then tweak the query to fetch documents under the proper root node only. It gives bigger indexes _but_ if you start having many sites, you don't have to create new indexes each time. Only if a new language comes up.
Stephan
Hi Stephen,
Great news (I was hooking up in the back end API node event to specify language hehe) so how can I "split" these indexes. Here is what I currently have.
In my ExamineSettings.config, for examine index providers:
Then in search providers:
In my ExamineIndex.config:
And then in my search macroscript:
Now I can easily identify my current language there and use another searcher, my problem is that I don't know how to specify that this searcher would use an index that would start it's index not from site root but from my specified language node. How did you specify that?
Thanks a lot!
Sébastien
We have...
Where IndexParentId is the identifier of the root node. Will index that node and everything below it, not the other nodes.
Stephan
Ohh silly me I could have tried it, I thought the IndexParentId would be very specify and index only children (which makes no sense). So it's behavior is actually like IndexAncertorId and it indexes descendants, from that point. Ok I'll try it right away!
Thanks a bunch Stephen!
Ok so it seems I can't find my descendants with this setup. Only the direct children of my specified IndexParentId. :(
In you setup Stephen, you find nodes that are descendants?
Thanks for the help
well, yes. maybe you need to rebuild the indexes? can you also try running Luke to check what you actually have in the indexes?
Yes ok I'm getting results! I just need to tweak for French accents and other stuff like ignore case. What analyser did you say you use for french?
Depends. If you're willing to rebuild Examine with Lucene 2.4.9g (latest) then I *think* there's an out-of-the-box french analyzer.
If you want to stick with stock Examine then you'll have to create your own french analyser I'm afraid. We have one, though, that I believe I could share. Does accents, stemming, stopwords, stuff like that.
Ok well it seams that using .Standard.StandardAnalyzer solves all my problems! Alright I think I'm all set here! Thanks again Stephen!
is working on a reply...