1

I am using SXA Search component and with that I want to use "Dropdown" filter which will have "Language" facets in the dropdown for the search items. I am able to achieve it by getting "_language" facet but it shows language code (i.e. en, fr-FR) in the dropdown.

Is there any way, I can show Language names instead of code (i.e. English, French, etc)? I want to use OOTB functionality if available.

Additionally, is there a way I can use Default filter value from dropdown on page load? It means, can I have "English" as default selection and search results accordingly on page load?

Please find the screenshot of existing dropdown is as below -

Ref Image as below

1 Answer 1

2

Facet filters are using values for the index. If inside of the index, the _language field has language codes :

enter image description here

then you will see language codes in the dropdown. What can be done here:

  • use custom field with language
  • try to find an existing field which has full language name instead of code. I noticed that there is a field called paresedlanguage. I have no idea what it is, probably it is a Sitecore field but it has full language name. Try to use it.

Regarding having the filter pre-selected. There is no such option. If you want to have filter pre-selected while opening the page, the URL would need to contain that facet after the hash (e.g.: #language=en).

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.