AI OnAI Off
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:
client.Search<IContent>()
.FilterOnLanguages(new string[] { "sv" })
...
Regards,
Henrik
But I guess that this would give me the same result? ".Filter(x => x.LanguageID.Match(CurrentPage.LanguageID));"
Hi,
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"?