Don't miss out Virtual Happy Hour this Friday (April 26).

Try our conversational search powered by Generative AI!




How do I handle pages published in different languages in Find? For example, I have a page published first in Finnish and then in English. Now when I search for it Find returns it in both languages even though I specifically defined that I'm only interested in finding pages in Finnish.

Here's the code:

var language = Language.GetAll().First(f => f.Name == ContentLanguage.PreferredCulture.EnglishName);
var query = SearchClient.Instance.Search<StationPage>(Language);
var results = query.StaticallyCacheFor(TimeSpan.FromHours(1)).Take(MAX_SEARCH_RESULTS).Take(MAX_SEARCH_RESULTS);

I checked with debugger that "language" is Finnish.

How do I tell Find that I'm only interested in pages in particular language? Or do I have to filter results "by hand"?

Feb 22, 2013 9:06

Hi Marko,

The language parameter that you are passing to the query does not filter hits, it tells Find how to interpret the query regarding language (if it should use stemming in any way). If you want to have only pages for a specific language branch returned you have to filter on that specific branch by using the FilterOnLanguages-extension in the EPiServer.Find.Cms-namespace:

.FilterOnLanguages(new string[] { "sv" })



Feb 25, 2013 9:05

Ach. Thank you. I'll try that.

Feb 25, 2013 9:36

Is FilterOnLanguages() only available for CMS 7 or am I blind? ;)

Feb 26, 2013 9:51

But I guess that this would give me the same result? ".Filter(x => x.LanguageID.Match(CurrentPage.LanguageID));"

Feb 26, 2013 10:04
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.