In a recent project I have been working on, we had a DEV, Staging and Prod environment on Sitecore managed Cloud - Containers, and one of the tasks we needed to do is to enable auto suggestions for SXA search box, in this post will show you how you can enable auto suggestions for SXA search box, how you can add search component and request handler to you solr instance specially in this case we are using searchStax for Solr nodes.
In order to accomplish this, the only way to update Solr Node on SearchStax is using Solr Config API, the following script add search component and request handler to be used by the auto suggestion, you would need to adjust your sdearchStax solr node url, username and password, then at the bottom you would need to list the indexes were you want to add the above:
If you try to run the above, you will probably run into the following issue:
Now, from the error message [solrconfig editing is not enabled due to disable.configEdit"], the disbale,configEdit is set to true by default which prevent you from making changes through the API, this is being added for security reasons, you can read more about it in the following article:
https://www.searchstax.com/docs/hc/why-is-config-api-disabled/ There is no way to workaround that, so you would need to create a sitecore support ticket, to ask them to reach out to SearcStax to enable that for you until you execute the scripts, then switch it back once you're done.
Following is a useful resources if you want to know more about SXA auto suggestion functionality, enable the Solr Suggester, and enable the Solr suggeter within Docker environment:
- https://support.sitecore.com/kb?id=kb_article_view&sysparm_article=KB0848433
- https://citizensitecore.com/2021/08/16/search-predictions-and-auto-complete-with-sxa/
Hopefully this will be useful for someone!
No comments:
Post a Comment