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:
- Non-ATP and DOM inventory systems are supported by index inventory data in WebSphere 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 WebSphere Commerce Search. See WebSphere 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 WebSphere 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 beginning
The inventory index is not created by default.
- Ensure that you have setup the search index for the master catalog, specifying both the CatalogEntry and CatalogGroup index types.
- Ensure that the store is using the non-ATP inventory system or a DOM system. If the store is using another inventory system such as ATP or External, either republish the store 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
- 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.
- If you customized the data in either the SRCHCONF and SRCHCONFEXT, redo our customizations.
- Restart your WebSphere Commerce Search server.
- Build the inventory index, specifying the inventory index subtype:
https://transaction_server_hostname:transaction_server_https_port/wcs/resources/admin/index/dataImport/build?indexSubType=InventoryFor 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.
- 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
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.