Tuesday, July 3, 2018

Sitecore Experience Commerce - Facets are limited to 100 results

I was debugging a Sitecore Experience Commerce product list locally (using SOLR as a search provider) and noticed that a category with a large number of brands to facet on, would always limit out at 100 results. This was not ideal as that 100 would include facets with 0 aggregate count (matches for a given search) which meant actual brands that were in the results would not appear as a valid facet.

This turned out to be a default setting with SOLR whereby the maximum number of facets to return for a given query was 100. This can be increased to a valid number as required or to unlimited with a setting of -1.

To increase the number of facets to return with a SOLR index in Sitecore, you will need to do the following.

  1. In the SOLR directory locate the index you wish to target.
    1. In my case this was the web index - which is located in C:\solr\server\solr\sc_web_index
  2. Inside the conf child director is a solrconfig.xml configuration file.
  3. The facet.limit setting needs to be edited - in my case this setting was not present
    1. A valid number to set a hard limit of facets to return or -1 for unlimited.
  4. Add or edit the setting in the following location.
  5. Restart the SOLR service.
<requestHandler name="/select" class="solr.SearchHandler">
<!-- default values for query parameters can be specified, these
  will be overridden by parameters in the request
<lst name="defaults">
  <str name="echoParams">explicit</str>
  <int name="rows">10</int>
  <str name="facet.limit">-1</str>

Note: the snippet has been cut-down, however there is enough here to see where to add the setting.

After making this change, I was now seeing all of the brand facet data that I was expecting.

No comments:

Post a Comment