Indexing contract prices in WebSphere Commerce Search

We can index prices in WebSphere Commerce Search. For example, we can build the WebSphere Commerce Search price index by issuing the Calculate Price RESTful call, and then indexing contract prices.


Prices in WebSphere Commerce Search

Prices returned by WebSphere Commerce Search are either indexed or calculated:

Indexed prices are populated quickly, but not evaluated dynamically. To ensure that the storefront displays accurate prices, we can change the price mode to suit your business needs.

When you work with prices and currencies in WebSphere Commerce Search, a separate index column is used by default to handle multiple currencies.


Indexing prices

We can index price data into the following locations, based on the number of contracts the site contains or the source of the price data:


Calculating prices

Prices can be calculated either fully, or for a specified catalog entry, contract, or currency. When full price recalculations are used, all prior price data is removed from the index before the B2B contract prices are recalculated. To help decide when and where to calculate prices, consider the following options:


Full price recalculations logic


Recalculations logic


Customization logic

Active and future contract prices are built into the catalog entry index by using field definitions that start with price_, followed by a combination of contract and currency. For example, price_USD_10001 or price_CNY_10002. In contrast, for releases without indexed contract prices, the catalog entry index uses field definitions that start with price_, followed only by its currency. The Calculate Price RESTful call resolves all deployed contracts for stores that share the specified master catalog. Then, it initializes the price API command to calculate prices for all the catalog entries that belong to the specified master catalog. When price data is embedded in the master CatalogEntry index, the calculated price result is saved into the TI_CNTRPRICE_#INDEX_SCOPE# temporary table. While when price data is located in extended sub core, the calculated price results are saved into the TI_EXT_CNTRPRICE_#INDEX_SCOPE# table. All the calculated results for a catalog entry are composed into a single column:

Name Type Description
CATENTRY_ID BIGINT NOT NULL The ID of the catalog entry. This column contains all catalog entry for the specified master catalog.
PRICE CLOB Multiple value pairs for different contracts and currency values that are separated with white space.

The NameValuePairTransformer is the default transformer that transforms the wide multiple value column into the dynamic price field. We can generate different dynamic price column names in Solr by customizing or creating a new transformer. If you customize the transformer, we must override the applyFieldNamingPattern method in the following classes to get the updated price column names:

In extended sites, the catalog asset store defines the price in the master catalog so that extended sites share the catalog asset store's prices. Or, the extended site can override the prices so that it contains the extended site-specific prices. Different extended sites can create specific items with specific price. When prices are calculated, the store-specific items are calculated first. Shared items are each calculated per store by their specific contract and currency. The price API gets the correct price, based on the specified contract, price rule, price model, or contract terms and conditions. Different extended sites can define different prices by using different contract. When a shopper logs on to a different extended site store, different contracts are resolved. Then, the shopper sees the relevant prices in the store, even for the same product in the master catalog.

Multiple price columns are set up in the catalog entry index. When a buyer logs on to the storefront, the eligible buyer contract is retrieved. If multiple eligible contracts exist, the buyer can select a contract to set for the session. Then, the corresponding price column that is related to the contract in session is displayed in the storefront. To customize this behavior, the ContractPriceCalculate URL uses ContractPriceCalculateCmd as the overall entry command. The logic can be overridden by a registering a new command implementation in the command registry table. To introduce different calculation logic, override the calculateStoreSpecificItemPrice and calculateSharedItemPrice methods in the ContractPriceCalculateCmd command. The IBM_Admin_CalculatePriceIndex access profile is used to bootstrap the common entry of the com.ibm.commerce.price.commands.CompositeGetContractUnitPriceCmdImpl price API:

If the store uses the price rule price model, we can use the following command implementation for performance reasons:

If the store uses the external price model, we can register our own price command to get your intended price result.


Workspace preview

When we use workspace preview:


Related reference
Propagating the search index