Try our conversational search powered by Generative AI!

Find pages belonging to different language branches

Vote:
 

We have a news page that uses episerver find for finding all articles that it will show in the news list.

We have setup fallback language for two of the languages we have on our site.

NB --> NN and NN --> NB (two norwegian languages)

How can we use episerver find to find all the articles in the current language AND the fallback language?

If we for instance have a news page in the language NB then we want to show following articles (the articles are filtered for some criterias):

- If an article exists in both NB and NN then the NB article is shown

- If an article only exists in NB then the NB article will be shown

- If an article only exists in NN then the NN article will be show (it is these articles we are struggeling with, how can we add these to the list?)

We are using EPiServer Find 7

#139329
Sep 30, 2015 10:29
Vote:
 

In the index, each language version of a page is indexed as a separate index document. When you search, you search among documents for your hits.

When you filter, you filter for terms that each one may disqualify a document from being a search hit.

What you ask for is a system that searches for document in either NN or NB, eliminates duplicates (by the hit's Content Id) and then retrieve those contents using the ContentRepository/ContentLoader with the primary language set to NB with a fallback to NN. A voila!

#139338
Sep 30, 2015 11:46
Vote:
 

That is exactly what I want :)
Could you post a code snippet to clarify how to accomplish it?

#139339
Sep 30, 2015 11:59
Vote:
 

Sorry, can't write your code :)  But I can give you pointers:

  • GetContentResult and GetFilesResult documentation does the last part (retrieves the hits from the ContentRepository, optionally specifying language handling)
  • Filters documentation allows you to tweak the filtering performed, check with a reflector if you'd like to step outside the beaten path. The implementations are generally quite easy to understand and tweak to your liking.
#139341
Sep 30, 2015 12:15
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.