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:
- Defined in the URL.
- Defined in the search profile.
- 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:
- 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
- WCDE_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.
- To update all unstructured content search profiles,
update the SearchContentSetup.jspf file with
the same parameters under the
catalogNavigationView
section.
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.
- To use minimum match and phrase slop for selected search
profiles:
- 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<80% 6<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<80% 6<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).
- 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.
- 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:
- Update the wc-component.xml file
on the Search EAR to define the MaximumSlop and MinimumMatch values
in the Relevancy section.