Troubleshooting: Product sequencing issues

Set a predefined order for the appearance of your products in WebSphere Commerce Search results.

Problem

Products that are returned by searches do not appear in the order you prefer.

Solution

Sequencing allows you to set a predefined display order for products in a category. You can set a sequence value for each product, and when browsing categories, you can order products in a way that drives sales.

Types of sequencing
  1. Shallow Sequencing Determining sequence of results based on product's sequence value.

    Shallow sequencing is normally used when you are not using deep search (showing products under category and its subcategories). It can also be used with deep search if you do not want to include the category's sequence value in the calculation.

  2. Deep Sequencing Determining sequence of results based on the product and category's sequence value.

    Deep sequencing allows the category sequence value to influence the result, so that products under a category with a low sequence value can be pushed to the top. It's important to know what sequencing behavior you want for your storefront, as each type of sequencing can result in significantly different results.

You can determine which type of sequencing your system is using by examining your search queries. The sort parameter of the query identifies the sequencing function.
Shallow Sequencing: sort=getSequenceByCatalogAndCategory(sequence,'catalogId','categoryId') asc
Deep Sequencing: sort=getDeepSequence(globalSequence,catalogId,categoryId) asc
Setting the sequencing type
The sequence might not be correct even though the sort parameter shows the right sequencing type. Two configuration settings can affect the sequencing result.
  1. Ensure that the EnableDeepProductSequence parameter is correctly set in the Search_eardir/xml/config/com.ibm.commerce.catalog/wc-component.xml file.
    <_config:property name="EnableDeepProductSequence" value="false" />
  2. The correct sequencing function parser must be defined for each sequencing function.
    <valueSourceParser name="getSequenceByCatalogAndCategory" 
        class="com.ibm.commerce.foundation.internal.server.services.search.function.solr.SolrSearchGetSequenceByCatalogAndCategoryFunctionParser" />
    
    <valueSourceParser name="getDeepSequence" 
        class="com.ibm.commerce.foundation.internal.server.services.search.function.solr.SolrSearchGetDeepSequenceFunctionParser" />
If these settings are correct, you can test the results by querying the index for products under the category in question, and sorting based on the sequencing function. Run the following query against the CatalogEntry core:
q=*:*&fq=parentCatgroup_id_search:catalogId_categoryId&fl=catentry_id,sequence&rows=100
You can verify in the response whether the catentry_ids being returned have the expected sequence values.
<response> 
<lst name="responseHeader">
      <int name= " status ">0</int>
      <int name="QTime">1</int> 
      <lst name="params"> 
        <Str name="q">*:*</str>
        <str name="fl">catentry_id,sequence</str> 
<Str name="rows">100</str>
        <Str name= "fq ">parentCatgroup_id_search: 10101_10118</str> 
      </lst>
   </lst>
   <result name="response" numFound="88" start="0">
      <doc>
        <arr name="sequence">
          <str>10101_10118_1.000000</str>
          <str>10152_10118_1.000000</str> 
</arr> 
<str name="catentry_id">15316</str> 
</doc>
...
      <doc> 
        <arr name="sequence"> 
          <str>10101_10118_1.880000</str>
          <str>10152_10118_1.880000</str>
</arr> 
           <str name="catentry_id">15404</str>       
</doc>
    </result>
If the wrong sequence values are being indexed, then check whether the preprocessing functions are retrieving the correct sequence values from the database. You can review the contents of the TI_CATGPENREL_#indexScopeTag# to confirm that the sequence value for the catentry matches what you see in Management Center. If this table does not have the correct sequence value, then review the query that you are using in wc-dataimport-preprocess-common.xml to retrieve data for the table.

If the correct sequence values are being indexed, review the results to confirm that the sequencing function is sorting the results properly.