In our previous post, we learned how to feed data into our Sitecore Search instance. The next logical question is how we are going to use it and display these items on our site. There are two approaches to do this and it’s very important to understand its pros and cons depending on our needs.
Sitecore Search API
As you can imagine, Sitecore Search provides a robust API that we can use to retrieve results items from our front end. This API can be used to search results, retrieve predictive suggestions, personalized similar items, pagination faceting, filtering, and more.
The main reason to use the API directly is to have full control over the functionality and styling of our modules. However, it also comes with some disadvantages like long development times and the need to implement analytic events manually on our end.
More details on how the API works can be found in the excellent official documentation and API Reference here:
Sitecore Search JS SDK
Sitecore Search also provides its own JS framework that we can use to quickly integrate their services and inject them into our Reach applications. This approach provides the same features as the search API and more.
The main reason to use the SDK is the rapid development by using premade UI components. Another important advantage is that the widgets built using the SDK already implement analytics events saving development time.
However, using the SDK also comes with its own disadvantages. The main one is that since this approach uses premade UI elements, it might be harder to accommodate the client’s specific functionality requirements or styling.
More information on how to use the SDK can be found in the official SDK documentation:
There’s no right or wrong in using any of these approaches as they have their own set of pros and cons. However, there are clear considerations that should be made:
If you want full control over your search listing modules, using the API is the way to go. However, if you want to quickly implement your modules using premade UI components, the JS SDK is definitely the way to go 😉