SXA Search box Suggestion component, returns error in specific cases if the returned results contain chars like "." or "\" for example.
In order to use suggestions please remember that you need to have:
- at least Sitecore 9.0
Before first usage you need to:
- In the
solrconfig.xmlfor 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, "").