Tuesday, June 1, 2021

Sitecore 10 - Setup auto suggestion (Predication) with Solr Cloud using Docker

 Today, I got a requirement to set up the auto-suggestion (Predication) for the SXA search, here are the steps to configure.


There are three options available but we wanted to configure the predications one

By default the search box will give you 404 when we do the query.

As per the Sitecore Documents, We need to configure the Suggester component and handler

https://doc.sitecore.com/users/sxa/18/sitecore-experience-accelerator/en/walkthrough--adding-search-functionality-to-your-page.html


and the name should be sxaSuggester, Although we can define and override on our own in this example we are going with the OOTB.

 Sitecore has also provided an example here https://doc.sitecore.com/developers/90/platform-administration-and-architecture/en/using-solr-auto-suggest.html with the sample configuration but the catch is in the sample configuration the name of the suggested is mySuggester so we need to make sure to update the correct name otherwise the search API will give you 404.

Steps to update - Go to your Docker build folder Example path docker\build\solr\Sitecore.zip - Unzip the file and update the 



To reflect the changes make sure to rebuild the image using docker-compose build solr (name of your solr image)

do the initialization and up again, you can verify your changes in the Solr through the admin panel. browser the file.

Make sure to refresh the collection and you would see the result in the search text box, I have used the field sxacontent_txn so there are a few unwanted fields and you can mention those field in the protected word to exclude from the search (I'm exploring more option to have a more purified suggestion and will update soon).

Let me know if you are implementing the prediction and found any issue, Happy to discuss and help.

Here is my SXA search in-depth review video that I presented in one of the Sitecore User Group -








No comments:

Post a Comment