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
-
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);
- Restart your WebSphere Commerce server.
-
Set up the inventory index, specifying the
Inventory
index subtype.- setupSearchIndex.bat -masterCatalogId masterCatalogId -indexsubtype Inventory
- setupSearchIndex.bat -instance instance_name -masterCatalogId masterCatalogId -dbuser db_user -dbuserpwd db_password -indexsubtype Inventory
- setupSearchIndex.sh -instance instance_name -masterCatalogId masterCatalogId -dbuser db_user -dbuserpwd db_password -indexsubtype Inventory
The SRCHCONF and SRCHCONFEXT - If you customized the data in either the SRCHCONF and SRCHCONFEXT, redo your customizations.
- Restart your WebSphere Commerce Search server.
-
Preprocess the inventory index, specifying the
full-path
of the inventory preprocessor configuration files.-
di-preprocess.bat WC_installdir\instances\instance_name\search\pre-processConfig\MC_masterCatalogId\databaseType\SubTypes\Inventory -instance instance_name -dbuser dbuser -dbuserpwd dbuserpwd
di-preprocess.sh WC_installdir/instances/instance_name/search/pre-processConfig/MC_masterCatalogId/databaseType/SubTypes/Inventory -instance instance_name -dbuser dbuser -dbuserpwd dbuserpwd
di-preprocess.sh WC_instance_root/search/pre-processConfig/MC_masterCatalogId/databaseType/SubTypes/Inventory -instance instance_name -dbuser dbuser -dbuserpwd dbuserpwd
di-preprocess.bat WCDE_installdir/search/pre-processConfig/MC_masterCatalogId/databaseType/SubTypes/Inventory
For more information, see Preprocessing the WebSphere Commerce Search index data. -
-
Build the inventory index, specifying the
inventory
index subtype:di-buildindex.bat -instance instance_name -masterCatalogId masterCatalogId -dbuser dbuser -dbuserpwd dbuserpwd -indexSubType Inventory
di-buildindex.sh -instance instance_name -masterCatalogId masterCatalogId -dbuser dbuser -dbuserpwd dbuserpwd -indexSubType Inventory
di-buildindex.bat -masterCatalogId masterCatalogId -indexSubType Inventory
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, 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
For more information, 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 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.