Feature Pack 7 or later

Enabling search result grouping

Enable search result grouping to increase the relevancy of products and search results in the storefront.

Before you begin

About this task

Perform this task... To do this....
Enable search result grouping for keyword searches. Generate search results for SKUs in the storefront.
Enable search result grouping for storefront navigation. Show products with their underlying SKUs when a shopper browses the storefront.
Disable the index-time roll up of attribute values to the product bean. Prevent attribute values from rolling up from any SKU to their parent's products.
Enable indexed price ranges for product in category pages. Show the price values for products with different SKUs in category pages. The price range is based on the product's underlying SKUs minimum and maximum offer prices.
Enable visually relevant products in the storefront. Provide visual relevancy in keyword searches.
Promote representative SKUs in search results that use search rules and merchandising attributes. Enable business users to promote a particular SKU when multiple SKUs exist. For example, if the SKU is on sale or overstocked.
Promote representative SKUs in store pages that use merchandising attributes. Enable business users to promote certain product-specific SKUs in store pages.

Procedure

  • Enable search result grouping for keyword searches.
    1. Update the SearchSetup.jspf file in the common directory of your store:
      • WC_eardir/Stores.war/widgetdir/Common
      • WebSphere Commerce DeveloperWCDE_installdir\workspace\Stores\WebContent\widgetdir\Common
    2. Locate the following snippet:
      
      <c:otherwise>
      <c:set var="includeContentSearch" value="true"/>
      <c:set var="searchProfile" value="IBM_findProductsBySearchTerm" scope="request"/>
      <%--
      Optimize the searchProfile based on pageView. If pageView != list, then we dont need attributes or child SKUs data.
      --%>
      <c:if test="${(empty env_displayRibbonAdInGridMode || env_displayRibbonAdInGridMode == 'false') && pageView 
         != 'list' && param.pageView != 'list' && env_defaultPageView != 'list'}">
      <c:set var="searchProfile" value="IBM_findProductsBySearchTerm_Summary" scope="request"/>
      </c:if>
      </c:otherwise>
      
      
    3. Add the following snippet at the end of the otherwise block:
      
      <c:set var="includeContentSearch" value="true"/>
      <c:set var="searchType" value="10" scope="request"/>
      <c:set var="searchProfile" value="IBM_findProductsBySearchTerm_grouping" scope="request"/> 
      
    4. To prevent situations where search results are returned but no facets are displayed, locate the following snippet:
      <c:if test="${totalSearchCount eq 0 && !empty spellcheck}" >
      Immediately after this if element, insert the same set searchType command as in Step 3:
      <c:set var="searchType" value="10" scope="request"/>
      The searchType variable must be set twice because it can happen that no products are returned by the original search. In such a case, the second REST call is used for the spellcheck search. If both values are not set, then the spellcheck search can return the expected results, but facet information is missing.
    5. Save your changes and close the file.
  • Enable search result grouping for storefront navigation.
    1. Update the CategoryNavigationSetup.jspf file in the common directory of your store:
      • WC_eardir/Stores.war/widgetdir/Common
      • WebSphere Commerce DeveloperWCDE_installdir\workspace\Stores\WebContent\widgetdir\Common
    2. Locate the second instance of the following snippet:
      
      <wcf:rest var="catalogNavigationView1" 
      url="${searchHostNamePath}${searchContextPath}/store/${WCParam.storeId}/productview/byCategory/${WCParam.categoryId}" > 
      
    3. Append the following snippet before it:
      
      <c:set var="searchType" value="10"/>
      <c:set var="searchProfile" value="IBM_findProductsByCategory_grouping"/>
      
    4. Save your changes and close the file.
  • Disable the index-time roll up of attribute values to the product bean.
    1. Update the wc-dataimport-preprocess-attribute.xml file:
      • WC_installdir/instances/instance_name/search/pre-processConfig/MC_masterCatalogId/databaseType/wc-dataimport-preprocess-attribute.xml
      • WebSphere Commerce DeveloperWCDE_installdir/search/pre-processConfig/MC_masterCatalogId/databaseType/wc-dataimport-preprocess-attribute.xml
    2. Locate the following snippet:
      
      <_config:data-processing-config>
      
      Where the snippet creates the TI_CATENTREL_0 temporary table.
    3. Comment out the <_config:query sql> snippet. For example:
      
      <_config:query sql="select rtrim(cast(a.catentry_id_parent as char(23))) ||'_'|| rtrim(cast(a.catentry_id_child as char(23))) 
      combinekey, a.catentry_id_parent catentry_id_parent, a.catentry_id_child catentry_id_child from catentrel a, ti_catentry_0 b, 
      catentry c WHERE a.catentry_id_parent=b.catentry_id and c.catentry_id=a.catentry_id_child and c.MARKFORDELETE=0 and 
      a.catreltype_id not in ('DK_PDK','PDK_COMPONENT')"/>
      
    4. Uncomment the following configuration:
      
      <_config:query sql="SELECT 1 CATENTRY_ID, '' catentry_id_parent FROM CATENTRY WHERE 1=-1"/>
      
    5. Save your changes and close the file.
    6. Preprocess and build the search index.
    7. If you manage search facets in the Management Center, redefine the search profile responsible for returning the facets in the Management Center to return facets based on SKUs, instead of the default products.
      1. Install the interim fix for APAR JR53316.
      2. Add the following profile into the wc-search.xml search configuration file of the WebSphere Commerce EAR:
        
        <_config:profile indexName="CatalogEntry" name="IBM_findFacetsByCategory">
               <_config:query>
                  <_config:param name="searchType" value="12"/>
               </_config:query>      
            </_config:profile>
        
  • Enable indexed price ranges for product in category pages.
    1. Update the PriceDisplay_Data.jspf file in the common directory of your store:
      • WC_eardir/Stores.war/widgetdir/Common
      • WebSphere Commerce DeveloperWCDE_installdir\workspace\Stores\WebContent\widgetdir\Common\PriceDisplay
    2. Locate the following snippet:
      
      <c:if test="${!empty minimumPrice}">
            <c:set var="minimumPrice" value="${minimumPrice.value}"/>
      </c:if>	    
      <c:if test="${!empty maximumPrice}">
            <c:set var="maximumPrice" value="${maximumPrice.value}"/>
      </c:if>
      
    3. Replace it with the following snippet:
      
      <c:set var="minimumPrice" value="${catalogEntryDetails.groupingProperties.groupMinPriceValue}" />
      <c:set var="maximumPrice" value="${catalogEntryDetails.groupingProperties.groupMaxPriceValue}" />
      
    4. Save your changes and close the file.
  • Enable visually relevant products in the storefront.
    1. Update the wc-search.xml file on the Search EAR and work with the following values:
      overrideFieldName
      A comma-separated list of Solr field names. When specified, some properties of the most relevant item in the group override the returned productBean properties. For example, thumbnail or name. The default value is thumbnail.
      showGroupPriceRange
      When set to true, the returned productBean price displays a price range based on the underlying SKUs that generated the search hits. The default value is false.
      For more information, see Changing properties in the WebSphere Commerce search configuration file (wc-search.xml) (Search EAR).
    For example, searching the storefront for red dress returns products that contain SKUs with the color red. The red SKU's thumbnail is displayed in the search results, instead of the product's default thumbnail:
    Red dress
    In addition, selecting a different color facet such as pink displays the pink SKU's thumbnail in the search results:
    Red dress and pink facet selected
  • Promote representative SKUs in search results that use search rules and merchandising attributes.
    1. Create an attribute dictionary attribute of type text, with one predefined value. Select use in merchandising and save it.
    2. Assign the attribute to a particular SKU as a descriptive attribute. Select the value, and save the SKU.
    3. Create a search rule to promote products that match the merchandising attribute value. Save and activate the search rule.
    4. Start store preview and wait until indexing is complete.
    5. Use a search term that generates search results on all the related SKUs of the one being updated.
    6. For example, you can assign a descriptive attribute to the AuroraWMDRS-009 SKU, which contains a blue thumbnail by default. When the search rule is activated, the AuroraWMDRS-1 product bean displays the promoted blue thumbnail, instead of its default red thumbnail.
    7. Search for Hermitage Fit and Flare Dress in the storefront to see the following results:

      Women dresses category
    The search results page promotes the Hermitage Fit and Flare Dress with its promoted blue thumbnail.
  • Promote representative SKUs in store pages that use merchandising attributes.
    1. Update the wc-search.xml file on the Search EAR to include the following merchandising attribute field names:
      
      <_config:profile name="IBM_findProductsByCategory_grouping" extends="IBM_findProductsByCategory">	
         <_config:heroproduct inherits="false">        		
         <_config:param name="overrideFieldName" value="thumbnail"/>
            <_config:param name="showGroupPriceRange" value="true"/>
            <_config:field name="ads_f10003" value="Hero"/> 
         </_config:heroproduct> 
      <_config:result inherits="true">
         <_config:field name="ads_f10003"/>
      </_config:result> 
      </_config:profile>
      
      For more information, see Changing properties in the WebSphere Commerce search configuration file (wc-search.xml) (Search EAR).
    2. Go to the Apparel > Women > Dresses page in the storefront to see the following results:

      Women dress category
    The category page promotes the Hermitage Fit and Flare Dress with its promoted blue thumbnail.