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 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. For more information, 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 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. Register the inventory usage types in the SRCHATTRPROP table so it is displayed in the Management Center search rules dynamic property list:
    
    INSERT INTO srchattr (SRCHATTR_ID, INDEXSCOPE, INDEXTYPE, IDENTIFIER, OPTCOUNTER) VALUES (10101, '0', 'CatalogEntry', '_cat.Inventory', 0);
    INSERT INTO srchattrprop (SRCHATTR_ID, PROPERTYNAME, PROPERTYVALUE, OPTCOUNTER) VALUES (10101, 'merchandising-Filter-Numeric', 'inventory', 0);
    INSERT INTO srchattrprop (SRCHATTR_ID, PROPERTYNAME, PROPERTYVALUE, OPTCOUNTER) VALUES (10101, 'merchandising-Rank-Numeric', 'inventory', 0);
    INSERT INTO srchattrdesc (SRCHATTR_ID, LANGUAGE_ID, DISPLAYNAME, DESCRIPTION, OPTCOUNTER) VALUES (10101, -1, 'Inventory', null, 0); 
    
  2. Restart your WebSphere Commerce server.
  3. Set up the inventory index, specifying the Inventory index subtype.
    • WebSphere Commerce DevelopersetupSearchIndex.bat -masterCatalogId masterCatalogId -indexsubtype Inventory
    • WindowssetupSearchIndex.bat -instance instance_name -masterCatalogId masterCatalogId -dbuser db_user -dbuserpwd db_password -indexsubtype Inventory
    • LinuxAIXFor IBM i OS operating systemsetupSearchIndex.sh -instance instance_name -masterCatalogId masterCatalogId -dbuser db_user -dbuserpwd db_password -indexsubtype Inventory
  4. If you customized the data in either the SRCHCONF and SRCHCONFEXT, redo your customizations.
  5. Restart your WebSphere Commerce Search server.
  6. Preprocess the inventory index, specifying the full-path of the inventory preprocessor configuration files.
    • Windows di-preprocess.bat WC_installdir\instances\instance_name\search\pre-processConfig\MC_masterCatalogId\databaseType\SubTypes\Inventory -instance instance_name -dbuser dbuser -dbuserpwd dbuserpwd
    • LinuxAIXdi-preprocess.sh WC_installdir/instances/instance_name/search/pre-processConfig/MC_masterCatalogId/databaseType/SubTypes/Inventory -instance instance_name -dbuser dbuser -dbuserpwd dbuserpwd
    • For IBM i OS operating systemdi-preprocess.sh WC_instance_root/search/pre-processConfig/MC_masterCatalogId/databaseType/SubTypes/Inventory -instance instance_name -dbuser dbuser -dbuserpwd dbuserpwd
    • WebSphere Commerce Developerdi-preprocess.bat WCDE_installdir/search/pre-processConfig/MC_masterCatalogId/databaseType/SubTypes/Inventory
  7. Build the inventory index, specifying the inventory index subtype:
    • Windowsdi-buildindex.bat -instance instance_name -masterCatalogId masterCatalogId -dbuser dbuser -dbuserpwd dbuserpwd -indexSubType Inventory
    • LinuxAIXFor IBM i OS operating systemdi-buildindex.sh -instance instance_name -masterCatalogId masterCatalogId -dbuser dbuser -dbuserpwd dbuserpwd -indexSubType Inventory
    • WebSphere Commerce DeveloperDB2Oracledi-buildindex.bat -masterCatalogId masterCatalogId -indexSubType Inventory
    The inventory index is now set up and ready for use.
  8. 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 server. That is, authoring or staging servers 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 server, with mock inventory data loaded into the authoring database. If the mock inventory data does not exist on the authoring server, 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.