Feature Pack 7

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:
    1. 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).

    2. 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>
      
    3. Save and close the custom configuration file.
    4. Open the SearchSetup.jspf file for editing:
      • WC_installdir/Stores.war/widgetdir/Common/SearchSetup.jspf
      • WebSphere Commerce DeveloperWCDE_installdir\workspace\Stores\WebContent\widgetdir\Common\SearchSetup.jspf
    5. Update both instances of the catalogNavigationView1 section to include the minMatch value. For example, after the metaData parameter, add:
      
      <wcf:param name="minMatch" value="2" />
      
      Where the sample minimum match value is 2.
    6. Save your changes to the file.
    7. Delete all contents under the following directory:
      • WAS_installdir/profiles/instance_name/temp/WC_instance_name_node/server1/WC_instance_name/Stores.war/widgetsdir
    8. If you have JSP caching enabled, either clear the cache, or restart the WebSphere Commerce server.
    9. Restart the search server.
  • To use minimum match for selected search profiles in a REST-based storefront:
    1. 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).

    2. 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>
      
    3. Save and close the custom configuration file.
    4. 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>
      
    5. 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.
      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"/>
    6. 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"/>
    7. Save your changes and close the files.
    8. Restart the WebSphere Commerce and search servers.
  • If you are using a BOD-based storefront:
    1. Open the following file for editing:
      • WC_installdir/wc.ear/Stores.war/WEB-INF/config/com.ibm.commerce.catalog-fep/get-data-config.xml
    2. 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>
    3. Open the SearchSetup.jspf file for editing:
      • WC_installdir/Stores.war/widgetdir/Common/SearchSetup.jspf
      • WebSphere Commerce DeveloperWCDE_installdir\workspace\Stores\WebContent\widgetdir\Common\SearchSetup.jspf
    4. 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 the physicalStoreIds parameter, add:
      
      <wcf:param name="minMatch" value="2" />
      
      Where the sample minimum match value is 2.
    5. Save your changes to the file.
    6. Restart the WebSphere Commerce server.