Indexing contract prices using Index Load
Before you begin
- Interim fixes for Feature Pack 8 are required to use this feature. Apply the latest cumulative interim fix for Feature Pack 8, JR53438.fep.
- Download and extract the following sample code: IndexLoadSampleCode.zip. The sample includes configuration files used by Index Load, and manual updates performed in this task, for reference.
- Copy the Index Load sample files to the Search EAR.
- From: IndexLoadSampleCode/IndexLoad_sample_configurations
- To: Search_eardir/xml/config/indexload
Procedure
- Configure the Index Load configuration files.Index Load requires three types of configuration files, based on the XML schema definitions of the Data Load framework:
Index Load configuration files
Index Load configuration file Data Load definition file Environment configuration file (wc-indexload-env.xml) wc-dataload.xsd Profile configuration file (wc-indexload-profileName.xml) wc-dataload-env.xsd Profile item configuration file (wc-indexload-businessobject.xml) wc-dataload-businessobject.xsd For more information about the Index Load configuration files, see Index Load configuration files for indexing.
- Create the external price subindex.The price index is an extended sub core that contains price information, instead of storing it in the catalog entry core.Note: The order in which you setup the Price index, and the location of the schema file you update differs, depending on whether your site already contains a catalog entry index setup against the targeted catalog ID. To create the external price subindex, where you do not already have an existing catalog entry index setup for the catalog ID you are targeting:
- Update the schema.xml file to contain
the price dynamic field:
- Open the WC_installdir/components/foundation/subcomponents/search/solr/home/template/CatalogEntry/conf/locale/locale_name/schema.xml file for editing.
- Comment out the following snippet:
As a result, the field instead looks like:<dynamicField name="price_*" type="wc_price" indexed="true" stored="true" multiValued="false"/>
<!-- <dynamicField name="price_*" type="wc_price" indexed="true" stored="true" multiValued="false"/> -->
- Save your changes and close the file.
- Update the wc-data-config.xml file
to remove all references of offer prices and contract prices:
- Open the WC_installdir/components/foundation/subcomponents/search/solr/home/template/CatalogEntry/conf/database/dbtype/wc-data-config.xml file for editing.
- Remove all references of reading source data from the TI_OFFERPRICE and TI_CNTRPRICE tables.
- Save your changes and close the file.
- Copy the price schema template files from the sample
code into Solr home:
- From:
IndexLoadSampleCode/Solr_Home_sample_data/generic/Price/conf/schema.xml
- To:
WC_installdir/components/foundation/subcomponents/search/solr/home/template/CatalogEntry/conf/generic/Price/conf/schema.xml
- From:
IndexLoadSampleCode/Solr_Home_sample_data/generic/Price/conf/solrconfig.xml
- To:
WC_installdir/components/foundation/subcomponents/search/solr/home/template/CatalogEntry/conf/generic/Price/conf/solrconfig.xml
- From:
- Run the setupSearchIndex utility, specifying the Price index
subtype:
- Complete one of the following tasks:
- Log on as a WebSphere Commerce non-root user.
- Log on with a user profile that has *SECOFR authority.
- Log on with a user ID that is a member of the Windows Administration group.
- Go to the following directory:
- WC_installdir\components\foundation\subcomponents\search\bin
- WCDE_installdir\components\foundation\subcomponents\search\bin
- Run the search index setup utility, specifying the Price index
subtype:
setupSearchIndex.bat -masterCatalogId masterCatalogId -indexsubtype Price [util_specific_params]
setupSearchIndex.bat -masterCatalogId masterCatalogId -indexsubtype Price [util_specific_params]
setupSearchIndex.sh -masterCatalogId masterCatalogId -indexsubtype Price [util_specific_params]
Where:- masterCatalogId
- The ID of the master catalog (for example, 10101).
- indexsubtype
- Indicates the search engine index subtypes to set up. Indicating Price sets up a subindex for price data, instead of storing it in the catalog entry core.
- util_specific_params
- For more information about utility-specific parameters and actions that are not related to setting up the price subindex, see setupSearchIndex utility.
- Ensure that the utility runs successfully; or review the log file,
WC_installdir/components/foundation/subcomponents/search/config/logging.properties.You can get more logging information by updating the logging level from
INFO
toFINEST
:
For more information about the log file, and to enable more logging details, see Enabling tracing and logging for WebSphere Commerce search.# Default global logging level, INFO com.ibm.commerce.level=FINEST
- Restart the WebSphere Commerce search server.
- Complete one of the following tasks:
- Preprocess the WebSphere Commerce search index for both the CatalogEntry and CatalogGroup index types.
- Build the WebSphere Commerce search contract price index.
- Copy the price core name from the solrhome/solr.xml file
and register it in the Search_eardir/xml/config/com.ibm.commerce.catalog-ext/wc-search.xml file.
For example, the following snippet registers the price core called MC_10001_CatalogEntry_Price1_generic into the wc-search.xml file, which is then used by Index Load to locate the specified core name:
<_config:core catalog="10001" indexName="MC_10001_CatalogEntry_Price_generic" language="en_US" name="MC_10001_CatalogEntry_Price1_generic" path="/MC_10001/generic/CatalogEntry/Price/" serverName="BasicConfiguration"/>
To create the external price subindex, where you already have an existing catalog entry index setup for the catalog ID you are targeting:
- Copy the price schema template files from the sample
code into Solr home:
- From:
IndexLoadSampleCode/Solr_Home_sample_data/generic/Price/conf/schema.xml
- To:
WC_installdir/components/foundation/subcomponents/search/solr/home/template/CatalogEntry/conf/generic/Price/conf/schema.xml
- From:
IndexLoadSampleCode/Solr_Home_sample_data/generic/Price/conf/solrconfig.xml
- To:
WC_installdir/components/foundation/subcomponents/search/solr/home/template/CatalogEntry/conf/generic/Price/conf/solrconfig.xml
- From:
- Run the setupSearchIndex utility, specifying the Price index
subtype:
- Complete one of the following tasks:
- Log on as a WebSphere Commerce non-root user.
- Log on with a user profile that has *SECOFR authority.
- Log on with a user ID that is a member of the Windows Administration group.
- Go to the following directory:
- WC_installdir\components\foundation\subcomponents\search\bin
- WCDE_installdir\components\foundation\subcomponents\search\bin
- Run the search index setup utility, specifying the Price index
subtype:
setupSearchIndex.bat -masterCatalogId masterCatalogId -indexsubtype Price [util_specific_params]
setupSearchIndex.bat -masterCatalogId masterCatalogId -indexsubtype Price [util_specific_params]
setupSearchIndex.sh -masterCatalogId masterCatalogId -indexsubtype Price [util_specific_params]
Where:- masterCatalogId
- The ID of the master catalog (for example, 10101).
- indexsubtype
- Indicates the search engine index subtypes to set up. Indicating Price sets up a subindex for price data, instead of storing it in the catalog entry core.
- util_specific_params
- For more information about utility-specific parameters and actions that are not related to setting up the price subindex, see setupSearchIndex utility.
- Ensure that the utility runs successfully; or review the log file,
WC_installdir/components/foundation/subcomponents/search/config/logging.properties.You can get more logging information by updating the logging level from
INFO
toFINEST
:
For more information about the log file, and to enable more logging details, see Enabling tracing and logging for WebSphere Commerce search.# Default global logging level, INFO com.ibm.commerce.level=FINEST
- Restart the WebSphere Commerce search server.
- Complete one of the following tasks:
- Update the schema.xml file to contain
the price dynamic field:
- Open the solrhome/MC_masterCatalogId/locale_name/CatalogEntry/conf/schema.xml file for editing.
- Comment out the following snippet:
As a result, the field instead looks like:<dynamicField name="price_*" type="wc_price" indexed="true" stored="true" multiValued="false"/>
<!-- <dynamicField name="price_*" type="wc_price" indexed="true" stored="true" multiValued="false"/> -->
- Save your changes and close the file.
- Update the wc-data-config.xml file
to remove all references of offer prices and contract prices:
- Open the solrhome/MC_masterCatalogId/locale_name/CatalogEntry/conf/wc-data-config.xml file for editing.
- Remove all references of reading source data from the TI_OFFERPRICE and TI_CNTRPRICE tables.
- Save your changes and close the file.
- Preprocess the WebSphere Commerce search index for both the CatalogEntry and CatalogGroup index types.
- Build the WebSphere Commerce search contract price index.
- Copy the price core name from the solrhome/solr.xml file
and register it in the wc-search.xml file.
For example, the following snippet registers the price core called MC_10001_CatalogEntry_Price1_generic into the wc-search.xml file, which is then used by Index Load to locate the specified core name:
<_config:core catalog="10001" indexName="MC_10001_CatalogEntry_Price_generic" language="en_US" name="MC_10001_CatalogEntry_Price1_generic" path="/MC_10001/generic/CatalogEntry/Price/" serverName="BasicConfiguration"/>
- Update the schema.xml file to contain
the price dynamic field:
- Run Index Load:
- Open a web browser.
- Go to the following URL:
- http://hostname:port/search/indexload/command?query_parameters
Where the following command can be specified:- config
- Displays indexing configurations defined in the Index Load XML file.
- clear
- Deletes all contents from all index cores defined in the Index Load XML file.
- merge
- Merges all unloaded index data directories defined in the Index
Load XML file.Note: Ensure that all source index Solr cores are offline before merging. To do so, perform one of the following steps:
- Use the unload action for each core
that is not offline. For example:
or,http://hostname:3737/solr/admin/cores?action=UNLOAD&core=source_index_core_name
- Copy the source index data directory to a template directory. Then, in the wc-indexload-merge.xml file, use the template directory's index data as the input.
For more information about the Index Load configuration files for merging, see Index Load configuration files for merging indexes.
- Use the unload action for each core
that is not offline. For example:
- optimize
- Optimizes contents from all index cores defined in the Index Load XML file.
- start
- Performs indexing using configurations defined in the Index Load XML file.
- stop
- Stops all Index Load operations on the search server.
- status
- Reviews the current status of Index Load on the search server.
Where the following mandatory query parameters must be specified:- profile
- The name of the Index Load profile.
- The profile name is used to look up the configuration file name when the Index Load servlet is initialized.
- detail
- Returns more detailed index-related information.
- The default value is false.
Alternatively, you can view a list of all the available Index Load parameters by going to the following URL in your environment:- http://hostname:port/search/indexload/usage
For example:Sample usage
Sample URL Description http://hostname:port/search/indexload/start?profile=price&detail=true Performs indexing using the price profile, and returns more detailed information. http://hostname:port/search/indexload/status?profile=price Checks the current status for the price profile. http://hostname:port/search/indexload/merge?profile=merge&detail=true Merges all unloaded index data directories, and returns more detailed information.