Set up and build the inventory index

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

Important:

The following inventory sources are used by default:


Before beginning

The inventory index is not created by default.


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 the 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 our 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 our customizations.

  3. Restart your WebSphere 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 WebSphere Commerce Search index. For more information see, Building the WebSphere 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, we 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

    See Creating and scheduling the UpdateSearchIndex job.


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 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.