Try our conversational search powered by Generative AI!

Compound splitting not working for Optimizely Search & Navigation

Vote:
 

I'm following this guide to enable compound splitting for our Norwegian site https://world.optimizely.com/documentation/developer-guides/search-navigation/architecture-and-languages/#:~:text=Language%2Dspecific%20queries.-,Compound,-splitting

After having configured the seach code to enable compound splitting, the search results is as if it's still disabled. Using the same example word "Ståltermos", which also is a Norwegian word, I don't get the search result when searching for either "Stål" or "termos". Only when search for the whole compound word "Ståltermos" I get the result back. The Search & Navigation index is also in Norwegian.

search = _searchClient.Search<T>(Language.Norwegian)
                    .For(query.SearchText, x => x.Analyzer = Language.Norwegian.Analyzer)
                    .ExcludeDeleted()
                    .ApplyBestBets()
                    .Take(1000);

It also says that it's "New in Optimizely.Search & Navigation 12.3.0", which makes no sense to me. We're using the nuget packages EPiServer.CMS 12.3.1 and EPiServer.Find.Cms 14.0.4.

#276427
Mar 16, 2022 8:43
Vote:
 

I think "New in Optimizely.Search & Navigation 12.3.0" means that this was introduced in Epierver.Find 12.3.0.

I have not tested with Find 14.* but worked in previous versions. If you change your search like this, does it work then?

search = _searchClient.Search<T>(Language.Norwegian)
                    .For(query.SearchText, x => x.Analyzer = Language.Norwegian.Analyzer)
                    .Take(1000);
#276965
Mar 22, 2022 23:01
Vote:
 

I still doesn't work after having removed ExcludeDeleted() and ApplyBestBets() from the search. 

#276973
Mar 23, 2022 7:33
Vote:
 

When creating the search index, the supported languages are properties that can be set.

Could the problem be that Norwegian is not enabled on the index level?

#276980
Mar 23, 2022 11:22
Vote:
 

When I created the index, I set the language to Norwegian.

From find.episerver.com:

#276983
Mar 23, 2022 11:26
Vote:
 

For anyone wondering, we got it working with this code:

var search = _searchClient.Search<T>(Language.Norwegian)
                .For(query.SearchText)
                .InFields(x => x.SearchTitle(), x => x.SearchText())

Having Language.Norwegian set in the search method parameter seem to implicitly set the analyzer anyways. Alternatively, set the analyzer explicitly in the For() method.

Compound splitting is for various reasons not implemented for the _all field, so you have to set which fields to search in. Using the ContentExtensions from EPiServer.Find.CMS, you can set the search field for all searchable text from the used model.

#277595
Apr 01, 2022 9:23
Tomas Hensrud Gulla - Apr 01, 2022 12:21
Nice! Thanks for sharing the solution!
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.