Enabling minimum match in Feature Pack 7
You can enable minimum match in Feature Pack 7 to specify the number of search keywords
that are required to match the indexed document, when the
ANY
search type is
used.
Procedure
You can set up minimum match for all search profiles, or for selected search
profiles.
-
To use minimum match for all search profiles in a REST-based storefront:
-
Create a new extended wc-component.xml file within the
com.ibm.commerce.catalog-ext directory on the Search EAR to contain your
customizations.
For more information about creating this file and setting values in the file, see Changing properties in the component configuration file (wc-component.xml) (Search EAR).
-
Update the wc-component.xml file on the Search EAR to define the
minMatch value:
<_config:valuemappingservice> <_config:valuemapping externalName="SearchControlParameterMapping" internalName="SearchControlParameterMapping"> <_config:valuemap externalValue="minMatch" internalValue="_wcf.search.internal.edismax.mm"/> </_config:valuemapping> </_config:valuemappingservice>
- Save and close the custom configuration file.
-
Open the SearchSetup.jspf file for editing:
- WC_installdir/Stores.war/widgetdir/Common/SearchSetup.jspf
- WCDE_installdir\workspace\Stores\WebContent\widgetdir\Common\SearchSetup.jspf
-
Update both instances of the
catalogNavigationView1
section to include the minMatch value. For example, after themetaData
parameter, add:
Where the sample minimum match value is 2.<wcf:param name="minMatch" value="2" />
- Save your changes to the file.
-
Delete all contents under the following directory:
- WAS_installdir/profiles/instance_name/temp/WC_instance_name_node/server1/WC_instance_name/Stores.war/widgetsdir
- If you have JSP caching enabled, either clear the cache, or restart the WebSphere Commerce server.
- Restart the search server.
-
Create a new extended wc-component.xml file within the
com.ibm.commerce.catalog-ext directory on the Search EAR to contain your
customizations.
-
To use minimum match for selected search profiles in a REST-based storefront:
-
Create a new extended wc-component.xml file within the
com.ibm.commerce.catalog-ext directory on the Search EAR to contain your
customizations.
For more information about creating this file and setting values in the file, see Changing properties in the component configuration file (wc-component.xml) (Search EAR).
-
Update the wc-component.xml file on the Search EAR to define the
minMatch value:
<_config:valuemappingservice> <_config:valuemapping externalName="SearchControlParameterMapping" internalName="SearchControlParameterMapping"> <_config:valuemap externalValue="minMatch" internalValue="_wcf.search.internal.edismax.mm"/> </_config:valuemapping> </_config:valuemappingservice>
- Save and close the custom configuration file.
-
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="MinMatch" value="3"/> </_config:query> </_config:profile>
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
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 existingGetUri searchProfile
element.For example:<GetUri uri="store/{storeId}/productview/bySearchTerm/{searchTerm}" description="Get products by search term based on below search profile." searchProfile="IBM_findProductsBySearchTerm,Custom_findProductsBySearchTerm,IBM_findProductsByNameOnly, IBM_findProductsByNameAndShortDescriptionOnly,IBM_findProductsByUnstructureOnly, IBM_findProductsBySearchTerm_Summary,IBM_findProductsBySearchTerm_grouping"/>
-
Update the searchSetup.jspf file to use the new search profile. Comment
out the existing IBM_findProductsBySearchTerm search profile and insert the new
Custom_findProductsBySearchTerm search profile where applicable:
<%-- <c:set var="searchProfile" value="IBM_findProductsBySearchTerm" scope="request"/> --%> <c:set var="searchProfile" value="Custom_findProductsBySearchTerm" scope="request"/>
- Save your changes and close the files.
- Restart the WebSphere Commerce and search servers.
-
Create a new extended wc-component.xml file within the
com.ibm.commerce.catalog-ext directory on the Search EAR to contain your
customizations.
-
If you are using a BOD-based storefront:
-
Open the following file for editing:
- WC_installdir/wc.ear/Stores.war/WEB-INF/config/com.ibm.commerce.catalog-fep/get-data-config.xml
-
In the getCatalogNavigationView expression builder, add the following value in bold:
<expression-builder> <name>getCatalogNavigationView</name> <data-type-name>CatalogNavigationView</data-type-name> <expression-template>{_wcf.ap='$accessProfile$';_wcf.search.profile='$searchProfile$';_wcf.search.internal.edismax.mm=’$minMatch$’; _wcf.search.facet.field.limit='$facetLimit$';_wcf.search.term='$searchTerm$';_wcf.search.intent.term='$intentSearchTerm$'; _wcf.search.originalterm='$originalSearchTerm$';_wcf.search.category='$categoryId$';_wcf.search.type='$searchType$'; _wcf.search.exclude.term='$filterTerm$';_wcf.search.exclude.type='$filterType$';_wcf.search.manufacturer='$manufacturer$'; _wcf.search.price.minimum='$minPrice$';_wcf.search.price.maximum='$maxPrice$';_wcf.search.facet='$facet$'; _wcf.search.advanced.facet='$advancedFacetList$';_wcf.search.exclude.facet='$filterFacet$';_wcf.search.sort='$orderBy$'; _wcf.search.meta='$metaData$';_wcf.search.source='$searchSource$'; _wcf.search.store='$physicalStoreIds$'}/CatalogNavigationView</expression-template> <param> <name>accessProfile</name> <value>IBM_Store_CatalogEntrySearch</value> </param> <param> <name>searchType</name> <value>0</value> </param> <param> <name>searchSource</name> <value>O</value> </param> <param> <name>searchProfile</name> <value>IBM_findCatalogEntryByNameAndShortDescription</value> </param> </expression-builder>
-
Open the SearchSetup.jspf file for editing:
- WC_installdir/Stores.war/widgetdir/Common/SearchSetup.jspf
- WCDE_installdir\workspace\Stores\WebContent\widgetdir\Common\SearchSetup.jspf
-
Update the first occurrence of the
<wcf:getData type="com.ibm.commerce.catalog.facade.datatypes.CatalogNavigationViewType">
section to include the minMatch value. For example, after thephysicalStoreIds
parameter, add:
Where the sample minimum match value is 2.<wcf:param name="minMatch" value="2" />
- Save your changes to the file.
- Restart the WebSphere Commerce server.
-
Open the following file for editing: