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.

Procedure

You can set up minimum match and phrase slop for all search profiles, for selected search profiles, or at the catalog component configuration file level. If you are operating in a clustered configuration, ensure that your changes are made in the Deployment Manager environment.
WebSphere 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 catalog component configuration file (wc-component.xml) on the Search EAR file.
  • 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:
      • WC_installdir/components/store-enhancements/wc.ear/Stores.war/widgetdir/Common/SearchSetup.jspf
      • WebSphere Commerce DeveloperWCDE_installdir/workspace/Stores/WebContent/widgetdir/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.
      Note: In order for the changes in the SearchSetup.jspf to take effect, the existing contents of the directory /opt/WebSphere/AppServer/profiles/demo/temp/WC_demo_node/server1/WC_demo/Stores.war/widgetdir must be deleted. If your system uses jsp/jspf caching you must also clear the cache, or restart the WebSphere Commerce 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 on the Search EAR 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 WebSphere Commerce Search configuration file (wc-search.xml) (Search EAR).

    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: In order for the changes in the SearchSetup.jspf to take effect, the existing contents of the directory /opt/WebSphere/AppServer/profiles/demo/temp/WC_demo_node/server1/WC_demo/Stores.war/widgetdir must be deleted. If your system uses jsp/jspf caching you must also clear the cache, or restart the WebSphere Commerce server.
    3. Update the Search_eardir/Search-Rest.war/WEB-INF/config/com.ibm.commerce.rest/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 wc-component.xml file on the Search EAR 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 component configuration file (wc-component.xml) (Search EAR).