Try our conversational search powered by Generative AI!

Autocomplete Suggestion on multisite



We are trying to autogenerate the most searched words in the search bar as tabs. The site exists in three languages: Swedish, Norwegian and Finnish. We want the autogenerated tabs to be specific depending on the language. Eg. The most searched words on the Swedish site to be tabs on the Swedish site. The most searched words on the Norwegian site to be tabs on the Norwegian site. Etc. 

We currently have the code below: 

result = SearchClient.Instance
.StatisticsAutocomplete(query.Length > 0 ? query : " ", count, new[] { ContentLanguage.PreferredCulture.TwoLetterISOLanguageName })
.Hits.Select(x => x.Query)

However we only get autogenerated tabs on the Swedish site, and not the others.

Using the line below, instead of the StatisticsAutocomplete-line, we are able to generate the tabs. However, the tabs generated are the most searched words overall and not specific for each site.

.GetAutocomplete(query, x => x.Size = count)

Is there anyway to have the tabs be specific for each language? 

Thank you in advance.

Edited, Oct 08, 2019 8:46

I have no idea if this will work, as I have never needed it or tried it, but you might try tracking with "tags" and retrieving them through .StatisticsAutocomplete instead of .GetAutocomplete with the same tag. In your case e.g the SiteId

Oct 08, 2019 13:43
Isabella - Oct 08, 2019 15:18
Thanks! I looked into your suggestion and did some additional changes. It works now!
Jeroen Stemerdink - Oct 08, 2019 15:28
Cool. What additional changes did you have to make?
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.