Extending the HCL Commerce Search base index schema

The base index schema can be extended to suit your business needs. For example, to separate data into different indexes that are based on their refresh intervals.

It can be extended by creating a new separate index schema and linking it to the base index. In some cases, it is more desirable to separate data into different indexes. In this scenario, you create a new separate index schema and link it to the base index.

For example, the product base index is used to store static data for the product, such as product identifier, name, and short description. These values typically do not change often. However, dynamic information such as product inventory or ratings change more frequently. Therefore, it is put into a separate index, where it can be refreshed at different intervals than the base product index.

The HCL Commerce Search base index schema is customized according to the following flow:
Extending the HCL Commerce Search base index schema
  1. The extension index artifacts must be created first, and placed in a specific directory under the deployed Solr home directory. The extension index schema structure is defined in the Solr schema.xml configuration file.

    For the base index to be able to reference an extension index, the extension index schema must define what is similar to a foreign key that matches the unique field name and type in the base index schema. The referenced field data type must be a simple data type such as String, Integer, or float. It must match the unique key name and type of the base index.

    Avoid common field names between extension indexes and the base index, other than the referenced field. It is recommended to use a naming convention that prefixes the extension index fields to avoid naming collisions.

  2. The extension index cores must be registered under the solr.xml file, as the Solr server loads indexes registered under the solr.xml file. This file also contains the mapping between the base index and extension index.
  3. The extension index must be registered in the HCL Commerce database. The HCL Commerce run time looks up all Solr indexes that are registered in the SRCHCONFEXT table. Extension indexes are registered as index subtypes of the base index.
Note: The Product Ranking index is used to demonstrate the steps that are needed to extend the Catalog Entry base index schema for master catalog ID 10001 in HCL Commerce Developer. The index type is CatalogEntry. The new index subtype is Ranking, and the new index core name is MC_10001_CatalogEntry_Ranking_generic.


  1. Create the extension index in the Solr server.
    1. Locate the sampleIndexCore template under the following directory: workspace_dir\components\foundation\samples\SolrIndex\template.
    2. Make a copy of the sampleIndexCore under the deployed Solr home generic\CatalogEntry directory. If the directories do not exist, create them: workspace_dir\search\solr\home\MC_10001\generic\CatalogEntry.
    3. Rename the copied sampleIndexCore to Ranking.

      The index core directory therefore becomes: workspace_dir\search\solr\home\MC_10001\generic\CatalogEntry\Ranking

    4. Update the schema.xml file under the conf core directory to add the new Ranking field:
      <field name="ext_ranking" type="tfloat" indexed="true" stored="true" multiValued="false" />
  2. Register the extension index in the solr.xml file.
    1. Locate and edit the solr.xml file under the Solr home directory: workspace_dir\search\solr\home
    2. Append the extension index core to the end of the listed cores:
      instanceDir="MC_10001\generic\CatalogEntry\Ranking\" name="MC_10001_CatalogEntry_Ranking_generic">
      <property name="notifyOnChange" value="MC_10001_CatalogEntry_en_US"/>
    3. Save and close the file.
  3. Register the extension index core into the SRCHCONFEXT table.
    INSERT INTO srchconfext (srchconfext_id,indextype,indexscope,indexsubtype,config) 
  4. Restart the test server.
  5. Verify the extension index at the following URL:
    • http://localhost/solr/MC_10001_CatalogEntry_Ranking_generic/select?q=*
    The response from the URL should resemble the following snippet:
    <?xml version="1.0" encoding="UTF-8"?>
       -<lst name="responseHeader">
          <int name="status">0</int>
          <int name="QTime">62</int>
          -<lst name="params">
             <str name="q">*</str>
       <result name="response" start="0" numFound="0"/> 

What to do next

To work with an inventory index in HCL Commerce Search, complete the following tutorial: Setting up and building the inventory index.