SXA Search box Suggestion component, returns error in specific cases if the returned results contain chars like "." or "\" for example.
-
This actually looks like a bug. I will try to confirm this and register as an issue in our backlog. I'll keep you updated. – Dawid Rutkowski Apr 24 '18 at 13:24
-
Thanks Dawid, Please let me know if there is a temp fix for this error – NAli Apr 26 '18 at 7:08
In order to use suggestions please remember that you need to have:
- at least Sitecore 9.0
- Solr
Before first usage you need to:
- In the
solrconfig.xml
for your index, you need to add suggest searchComponent and component need to be called sxaSuggester. - Create /suggest requestHandler in the same file
- Build the suggester http://localhost:8983/solr/sitecore_sxa_master_index/suggest?suggest.build=true. This will also tell you if your component is working fine.
- And you can query for some suggestions: http://localhost:8983/solr/sitecore_sxa_master_index/suggest?suggest.q=test
Keep in mind that what you will see depends on Solr configuration. There are thousands of possible suggestion configurations on Solr!
Regarding your issue: I can confirm that it was a bug and will be fixed in SXA 1.7.1. The problem was in this line:
As a quick workaround while waiting for SXA 1.7.1 you can replace this line with: text = data.html.replace(/(<([^>]+)>)/ig, "")
.