2

Working on Sitecore commerce 9 update 1.

Search-box is listing multilingual suggestions when typing.

I have an item with content in English and Chines version. I have 2 issues to highlight,

  1. When only English version is published, search result/suggestion will list english version content. But when English and Chines vesion is published, search result will only have Chinese version.
  2. On further investigation I found that, when the AJAX call is made for search suggestion, context language is not set in query string.

enter image description here

And also, when AJAX call is made from search result page context language is set ( because this page have a rendering where we can set the language filter).

enter image description here

Anyone worked on sitecore 9 SXA search component and came across this ?

Is there any way we can easily setup language filter in search component without customizing the OOTB module ?

3
  • I did have the same issue on a SXA site (no commerce) that the search suggestions were based on the current language.. As Support could not give me a patch, I disabled the suggestions. I would open a ticket with Sitecore Support and hope they have a fix now.
    – Gatogordo
    Dec 31, 2018 at 14:26
  • I suggest to customise the search-box.js where query suggestion url is building.append the language based on current context language if language parameter is empty.
    – Hussain
    Jan 1, 2019 at 15:00
  • So, for a quick fix we can edit search-box.js and then raise a ticket with Sitecore support. Jan 2, 2019 at 5:26

1 Answer 1

0

Let's clarify a few things. The Solr Suggester component doesn't support language at all. For more details please take a look here: https://lucene.apache.org/solr/guide/7_2/suggester.html

In SXA you have few options to receive suggestions as I described here: Where the auto suggest results implemented in SXA?.

Now, knowing about two above I'm assuming that you are not using real Solr suggestions but one of two other options which in fact are just showing search results as suggestions/predictions. I've just checked the last code (just code check without debugging) and as far as I can see the language is pass to createSuggestionsUrl() function in the component-search-box.js. Take a look here:

enter image description here

UPDATE - 03-01-2018

If you would like to pass language to the suggestion request please update Default langue filtering option in the Control Properties of the Search Box rendering. Take a look here:

enter image description here

If you will choose Current Language than inst.getLanguage() will return proper language.

6
  • 1
    We are using Azure search. The inst.getLanguuage() is getting empty when we have added SXA searchbox component in non SxA pages. I assume that language value is getting from Search result component from the current context language parameter. Here we have added only Search box component. As a result , language value is not getting the proper value.
    – Hussain
    Jan 2, 2019 at 12:46
  • @Dawid, I have searchbox on all pages. And I found that inst.getLanguuage() is set only when I do search from search-result page. Jan 2, 2019 at 12:54
  • @Jijo and Hussain I'll check that for you guys tomorrow when I'll be on front of the PC. Jan 2, 2019 at 17:09
  • @JijoViswanathan I've updated my question. Jan 3, 2019 at 10:33
  • @Hussain I've updated my question. Take a look at Default langue filtering dropdown in the Search Box parameters. Jan 3, 2019 at 10:34

Your Answer

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

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