Indexing contract prices using Index Load

We can use Index Load to index contract prices from a .CSV file.


Before beginning

  1. Copy the file server.config.dir/search/index/indexload/wc-indexload-contractprice.xml to the development environment project search-config-ext/src/main/resources/index/indexload.

  2. Update the following line in the copied Search EAR file wc-indexload-price.xml file to use your master catalog ID, instead of 10001:

      <_config:property name="coreName" value="MC_10001_CatalogEntry_Price_generic" />


Task info


Procedure

  1. Use SQL to create a Price subcore for the specified master catalogId. For example, if the masterCatalogId is 10001, the following SQL command will create Price subcore.

      Insert into srchconfext(srchconfext_id,indextype,indexscope,indexsubtype) 
      values(select max(srchconfext) 1 from srchconfext, "CatalogEntry","10001","Price");

  2. Restart the WebSphere Commerce Search server.

  3. When the Search server starts, a price subcore will be created in the solrhome/MC_mastercatalogId/generic/CatalogEntry/Price directory. For our example master catalogId, the core name will be MC_10001_CatalogEntry_Price_generic. This core name will be used later when composing the Index Load configuration file.

  4. We need two Index Load configuration files to load the price profile.

      server.config.dir/resources/search/index/indexload/wc-indexload-externalprice-demo.xml
      As well as specifying performance tuning parameters, this file specifies the configuration file that Index Load will use. It also contains the target core name and the datasource .CSV file.

        <_config:LoadItem name="ExternalPrice-1" fileName="wc-indexload-externalprice-csv.xml"> 
        <_config:property name="coreName" value="MC_10001_CatalogEntry_Price_generic" /> 
        <_config:property name="groupName" value="1" /> 
        <_config:DataSourceLocation location="resources/search/index/indexload/contract-price-example1.csv" /> 
        </_config:LoadItem> 

      server.config.dir/resources/search/index/indexload/wc-indexload-externalprice-csv.xml
      This file specifies the CSV mediator. The CSV mediator will be used to transform between the field in the CSV file and the fields of the Solr field.SearchIndexLoadCSVMediator. The mediator is defined as follows.

        </_config:BusinessObjectBuilder>
        <_config:BusinessObjectMediator className="com.ibm.commerce.foundation.internal.server.services.indexload.mediator.SolrIndexLoadBusinessObjectMediator"/> 
        <_config:BusinessObjectMediator className="com.ibm.commerce.search.indexload.mediator.SearchIndexLoadCSVMediator" />

  5. Use the Index Load service to load the inventory core with the configuration files.

      https://localhost:3738/search/admin/resources/indexload/profile/externalprice-demo/start 

    Note: To change the default settings, you need to edit the file under /search-config-ext/src/main/resources/index/indexload/ and go through the WCB and CI/CD pipeline to deploy the new configuration file to its container.


Results

We can check the status of the command with the following call:

The core can be called with the query: