Site search becomes more flexible when using the Starter Store. The main idea is to delegate to system integrators which search backend to use. Moreover, the existing component is extensible: for example, developers can provide their own extensions to combine search result fetched from different systems.
The Search component is mainly responsible for retrieving data (e.g. products) from the backend systems. Based on your Starter Store configuration, you will be able to display product search results coming from the selected API.
In addition, the search result page supports faceted navigation: you will be able to filter the search results based on specific attributes.
Bloomreach Discovery is fully supported in case of Products API: functionalities like autosuggest and related products work out of the box.
The Search component is a command chain delivery component. Currently, this component is able to interact with both Bloomreach API and commercetools. All the connectors in the Default Commerce Connector Set provide the productSearch component, that is used by the Search Component. In addition, the connector configuration provides another component, called facetList, returning only the set of facets related to a query parameter. Most of the time, facets are part of the product search result, but in some case cases they may be fetched separately.
If the pageableCommand is part of the chain, the result returned by the backend will be paginated. In case of the search result page, pagination options (like page size and query limit) can be specified directly in the console.
The Search Component is fully compatible with Bloomreach APIs. In case you want enable this option, you need to check the related option in the Channel settings, as explained in the Bloomreach Configuration documentation page.
The Starter Store boot application already provides a Search Box component in the header. If the Bloomreach APIs option is enabled, you will automatically integrate with autocomplete and product suggestions while typing queries, as showed in the image below:
Facets are part of the products search result: the boot application provides a product-list template which is able to display both facets and products together.
The Search component works seamlessly with commercetools. The Starter Store boot application provides configurations using the Product Projections API.
Facets must be considered separately. At the moment, the commercetools API is able to include facet values together with products search result, but facet names must be explicitely included in the API call. A possible idea would be to fetch Product Type attributes and include them while building a REST call against the Product Projections API.
The Starter Store boot application includes two types of template for product handling search results:
- starterstore-productsearch.ftl in case you are only interested in displaying the product grid
- starterstore-productlist.ftl in case you want to display facets and products in the same "section"
In addition, the boot application provides a template displaying only facet values:
- starterstore-facetlist.ftl rendering facet values related to products matching a specific query
Since the Search Component is a command chain delivery component, any command extending the default behaviour can be added in the related commands definition.
Bloomreach APIs: https://www.bloomreach.com/developer/api-catalogue
commercetools Product Projections API: https://docs.commercetools.com/http-api-projects-products-search