Tuning multiple-word search result relevancy by using minimum match and phrase slop

Tune multi-keyword search relevancy by using minimum match and phrase slop when ALL or EXACT search types are too restrictive, or when ANY search types return too many results.

You can set up minimum match and phrase slop for all search profiles, for the selected search server, or by using the search component configuration file level.

HCL Commerce Search checks for minimum match and phrase slop in the following order:
  1. Defined in the URL.
  2. Defined in the search profile.
  3. Defined in the search component configuration file (search-config-ext\src\runtime\config\com.ibm.commerce.search\wc-component.xml).

Procedure

  • To use minimum match and phrase slop for all search profiles:
    1. To update all structured content search profiles, update the SearchSetup.jspf file in the common directory of your store with the following parameters, under both instances of the catalogNavigationView1 section:

      workspace_dir/crs-web/WebContent/Widgets_801/Common/SearchSetup.jspf

      
      <wcf:param name="minMatch" value="2" />
      <wcf:param name="maxSlop" value="5" />
      
      Where the sample minimum match value is 2, and maximum phrase slop is 5.
      Note:
      • Solr ignores the minMatch parameter when Exclude is specified from the Advanced Search page in the storefront. For more information about this issue, see Apache: MM ignored in edismax queries with operators.
      • If your system uses JSP or JSPF caching you must also clear the cache, or restart the Transaction server and the Store server.
    2. To update all unstructured content search profiles, update the SearchContentSetup.jspf file with the same parameters under the catalogNavigationView section.
  • To use minimum match and phrase slop for selected search profiles:
    1. Update the wc-search.xml file to create a search profile that inherits from the IBM_findProductsBySearchTerm profile.
      
      <_config:profile name="Custom_findProductsBySearchTerm"
         extends="IBM_findProductsBySearchTerm">
      <_config:query inherits="true">
      <_config:param name="MaximumSlop" value="3"/>
      <_config:param name="MinimumMatch" value="2&lt;80% 6&lt;50%"/>
      </_config:query>
      </_config:profile>
      
      Important: You must use the correct character encoding when you enter percentage values in a file. For example:
      • In a JSP fragment file, such as SearchSetup.jspf, the preceding percentage value is entered as is: 2<80% 6<50%.
      • In an XML file, such as in this case, wc-component.xml, the preceding percentage value is entered as: 2&lt;80% 6&lt;50%.

      For more information about setting values in the file, see Changing properties in the HCL Commerce Search configuration file (wc-search.xml).

    2. Update the searchSetup.jspf file to use the new search profile, by commenting out the existing value and inserting the new value:
      
      <%-- <c:set var="searchProfile" value="IBM_findProductsBySearchTerm" scope="request"/> --%>
      <c:set var="searchProfile" value="Custom_findProductsBySearchTerm" scope="request"/>
      Note: If your system uses JSP or JSPF caching you must also clear the cache, or restart the Transaction server and the Store server.
    3. Update the wc-rest-resourceconfig.xml file to use the new search profile. Append Custom_findProductsBySearchTerm to the existing GetUri searchProfile element.
  • To specify minimum match and phrase slop at the catalog component configuration file level:
    1. Update the search-config-ext\src\runtime\config\com.ibm.commerce.search\wc-component.xml file to define the MaximumSlop and MinimumMatch values in the Relevancy section.

    For more information about setting values in the file, see Changing properties in the HCL Commerce configuration file (wc-component.xml).