Building the HCL Commerce Search index

You can build the HCL Commerce Search index using the build index RESTful call. The build index call updates the information in the Master Index by using the Data Import Handler (DIH) service to build the index. It builds the index either partially through delta index updates or completely through full index builds. When there are multiple indexes, for example, each language by using its own separate index, the index is built multiple times.

Before you begin

  • Development environment
    • Ensure that the Transaction server and Search server are started in Rational Application Developer.
    • Ensure that you can visit Solr over HTTP, for example: http://search_hostname:search_http_port/solr/admin/cores?
  • Runtime environment
    • Ensure that both the Transaction server, and the Search server are running.
    • Ensure that you can visit Solr over HTTP, for example http://search_hostname:search_http_port/solr/admin/cores? You will use HTTPS to make the actual build index call. You can run POST HTTPS requests by using a browser add-on, for example, HttpRequester for Mozilla Firefox or Postman for Google Chrome.
  • In both environments, ensure that you have updated the certificates for the Transaction server before making the Build Index REST call. Add the certificate to the trust list of your browser by accessing the request URL directly with the browser.
    Two ways to do this are:
    • If you are using an HTTP client plugin, such as Postman, DHC or HttpRequester, visit the build index URL using the browser in which the plugin is installed and add an exception for the self-signed certificate. Then, call the build index REST spi sign-on using the plugin.
    • From a command prompt, issue the following command:
      curl -k -s -X POST -u spiuser:spi_plain_text_password https://ts-server-hostname:ts-https-prt/wcs/resources/admin/index/dataImport/build?masterCatalogId=master-catalog-id

Procedure

  1. Run the build index REST command. The method is POST, and you must include basic authentication in the header, i.e., a spiuser ID and corresponding password. In the development environment, the transaction_server_https_port is the default, so you can specify 443 or leave it blank unless you have changed it. In the runtime environment, the port number is 5443. If you are unsure of the port number, log in to the Transaction server and run the command docker ps to find the port mapping of the ts-app process. Make the POST HTTPS request by using a browser add-on such as example, HttpRequester, for Mozilla Firefox, or Postman, for Google Chrome.
    The command to build the index is:
    https://transaction_server_hostname:transaction_server_https_port/wcs/resources/admin/index/dataImport/build?masterCatalogId=masterCatalogId
    Where:
    masterCatalogId
    Required: The ID of the master catalog (for example, 10101).
    If you do not know the master catalog ID, run the following SQL:
    SQL: select * from catalog where IDENTIFIER='STORE_IDENTIFIER'
    
    To find the master catalog ID for an Extended Site store:
    1. Find the store ID:
      select * from storeent where IDENTIFIER='STORE_IDENTIFIER'
      
    2. Use the storeent_id as the store_id in the following SQL to find the catalog asset store ID of this Extended Site store:
      
      select * from storerel where store_id=XXXXXX and streltyp_id=-4 and relatedstore_id not in (XXXXXX)
      
      Where XXXXXX is the storeent_id from the SQL in step 1.a when building the search index.
    3. Get the master catalog ID:
      
      select * from storecat where storeent_id=YYYYYY and mastercatalog='1'
      
      Where YYYYYY is the relatedstore_id from step 1.b when building the search index.
    indexType
    Optional: Indicates the search engine index to set up for a more granular level of indexing.
    Valid values:
    • CatalogEntry: Sets up the index for catalog entries in the master catalog.
    • CatalogGroup: Sets up the index for categories in the master catalog.

      If you do not use the indexType parameter, both the CatalogEntry and CatalogGroup indexes are built by default.

    indexSubType
    Optional: Indicates the search engine index subtypes to set up. This parameter accepts only one value at a time. It does not accept multiple values.
    Valid values:
    Structured
    Sets up the index for structured content.
    Unstructured
    Sets up the index for unstructured content.
    WebContent
    Sets up the index for site content.
    Inventory
    Sets up the index for inventory data.
    Price
    If price index is embedded into the CatalogEntry core, this parameter only calculates price. If the price index is located in a separate Solr index core, this parameter calculates prices and initializes the index for price data.

    If you do not use the indexSubType parameter, the Structured, Unstructured, and WebContent index subtypes are built by default. If you set the indexType to be CatalogGroup, you can set the indexSubType to be Structured. You can set any indexSubType value when you set CatalogEntry to be the indexType value.

    fullBuild
    Optional: A flag that indicates whether it is a full index build. The accepted values are either true or false. The default value is true.
    localeName
    Optional: The locale to index.
    • All
    • de_DE
    • en_US
    • es_ES
    • fr_FR
    • it_IT
    • ja_JP
    • ko_KR
    • pl_PL
    • pt_BR
    • ro_RO
    • ru_RU
    • zh_CN
    • zh_TW
    The default value is All.
    Note: To index a new language, this language should be added in SRCHCONF table and SRCHCONFEXT table. For more information, see Indexing a new language in HCL Commerce Search
    The response for build index RESTFul call is similar to the following example:
    {"jobStatusId":1001}
    where 1001 is the job id for this build index.
  2. Check build index status.
    If you are checking the status of an index build, issue the following HTTP request:
    https://{ts_server_hostname}:{ts_https_port}/wcs/resources/admin/index/dataImport/status?jobStatusId={jobstatusId}
    Method: GET
    header: basic auth for spiuser and its password
    
    You can also check the status using the Linux cURL command.
    curl -k -u spiuser:plain_text_spiuserPassword -X GET https://hostname:3738/search/admin/resources/index/build/status?jobStatusId=jobstatusId

What to do next

After the search index builds, you can optionally replicate and propagate the HCL Commerce Search index.