Setting up and building the inventory index

The inventory index, a separate index that contains index data, is an extension of the product index. For accurate inventory status, you can refresh the inventory index more frequently than the product index.

Important:
  • Non-ATP and DOM inventory systems are supported by index inventory data in HCL Commerce Search. ATP, External, and No-inventory types are not supported with the Search inventory index.
  • The filterCache and documentCache are required when an extension index such as Inventory exists in HCL Commerce Search. For more information, see HCL Commerce Search performance tuning.
The following inventory sources are used by default:
  • The inventory index is used in the Marketing tool to exclude out-of-stock products, and promote overstock products.
  • The HCL Commerce database is used to display inventory counts in the storefront. That is, customization is required to use the inventory index to display inventory counts in the storefront.

Before you begin

The inventory index is not created by default.

  • Ensure that you have setup the search index for your master catalog, specifying both the CatalogEntry and CatalogGroup index types.
  • Ensure that your store is using the non-ATP inventory system or a DOM system. If your store is using another inventory system such as ATP or External, either republish the store by using the non-ATP inventory system, or update the store to use the non-ATP inventory system:
    
    update STORE set INVENTORYSYSTEM=-2 where STORE_ID in (store_id);
    

Procedure

  1. Check the inventory configuration in the SRCHCONFEXT table by running the following SQL command:
    select * from srchconfext where INDEXSUBTYPE='Inventory';
    If no record for your master catalog Id exists, insert a record into the SRCHCONFEXT table using this SQL declaration:
    INSERT INTO srchconfext (SRCHCONFEXT_ID, INDEXTYPE, INDEXSCOPE, LANGUAGE_ID, INDEXSUBTYPE, CONFIG, OPTCOUNTER) 
    VALUES (id, 'CatalogEntry', 'masterCatalogId', null, 'Inventory', '', 1);
    The ID used above, and the masterCatalogId should change into your own. Verify that a record with the same indextype and indexscope exists in SRCHCONF table.
  2. If you customized the data in either the SRCHCONF and SRCHCONFEXT, redo your customizations.
  3. Restart your HCL Commerce Search server.
  4. Build the inventory index, specifying the inventory index subtype:
    https://transaction_server_hostname:transaction_server_https_port/wcs/resources/admin/index/dataImport/build?indexSubType=Inventory
    For information about the parameters of the index build REST call, see Building the HCL Commerce Search index.
    For more information see, Building the HCL Commerce Search index.
    The inventory index is now set up and ready for use.
  5. Schedule how frequently to index the inventory index.

    For example, you can schedule the refresh at one hour intervals, as opposed to longer intervals for the product index.

    The following job parameters indicate reindexing the inventory index subtype for the 10001 master catalog ID:
    
    mode=5&indexSubType=Inventory&masterCatalogId=10001
    

What to do next

After the inventory index is set up, business users can use the Marketing tool to exclude out-of-stock products, and promote overstock products: Example: Promoting or excluding products using inventory data.
Note: Inventory is operational data that is set up and configured on the production environment. That is, authoring or staging environments typically do not contain inventory data. When business users create search rules for excluding out-of-stock products, the inventory index must be set up on the authoring environment, with mock inventory data loaded into the authoring database. If the mock inventory data does not exist on the authoring environment, searches in the authoring storefront or store preview do not work correctly. If inventory index does not exist, all products are considered out-of-stock.