1

I am using rendering variant query item to write the search build query to get the related items.

I want to query items that should also match current user context language.

I have tried using language: en explicitly in the query to check but still I get items in the result other than English:

enter image description here

Please find the attached query:

+template:{342696b0-2b67-406f-c7acc7894741};+sxa:TaggedWithAtLeastOneTagFromCurrentPage|SxaTags;+language:en;+sort:__smallupdateddate_tdt[desc]

enter image description here

1
  • 1
    To get the English language result in build query, you need to use language:english Apr 10, 2023 at 8:25

1 Answer 1

1

The language field in the Search Query Builder is mapped to the index field parsedlanguage. It means that this field is looking at the full language names, for example "english", "english_united_states", german_germany" instead of culture codes like "en", "en-US", "de-DE".

So if you want to search by the context language code, consider using the culture field in your search query like this:

custom:culture|en

Search query with culture field

You can also try using the language field, but be careful if you have more than one culture for the same language on the website because the following query will return results for all matching languages ("English", "English (United States)", etc.):

language:english

Search query with language field

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.