Virtual Happy Hour this month, Jun 28, we'll be getting a sneak preview at our soon to launch SaaS CMS!

Try our conversational search powered by Generative AI!

Compound splitting not working for Optimizely Search & Navigation


I'm following this guide to enable compound splitting for our Norwegian site,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)

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.

Mar 16, 2022 8:43

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)
Mar 22, 2022 23:01

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

Mar 23, 2022 7:33

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?

Mar 23, 2022 11:22

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


Mar 23, 2022 11:26

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

var search = _searchClient.Search<T>(Language.Norwegian)
                .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.

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.