Configuring the Data Import Handler mapping

In this lesson, you extract the data for the custom fields from the temporary relational table in the search schema. The data extraction is handled by the Data Import Handler, which uses configuration files that include predefined SQL query lines that extract HCL Commerce data. To extend the extraction scope, you append queries for the customer ratings data to the files for the handler.

Note: During this task, you add fields for your master catalog. As an example, this tutorial uses a master catalog with an ID of "10001" and uses the locale "en_US". Change the values to reflect the values for your environment. If you want to add the fields for more catalogs or languages, you must repeat the following process for those catalogs and languages.

Procedure

  1. Edit the file wc-dataimport-preprocess-x-finalbuild.xml located at workspace_dir\WC\xml\search\dataImport\v3\dbtype\CatalogEntry.

  2. Add "TI_RATING.RATING" using a select query and "LEFT OUTER JOIN TI_RATING ON (CATENTRY.CATENTRY_ID=TI_RATING.CATENTRY_ID" using a from query for "CREATE VIEW X_VI_CE_#INDEX_SCOPE_TAG#_#lang_tag#"
  3. The final SQL should be something like the following:
    <_config:table definition="CREATE VIEW X_VI_CE_#INDEX_SCOPE_TAG#_#lang_tag# 
    AS( SELECT CATENTRY.CATENTRY_ID PK, CATENTRY.FIELD1 X_FIELD1_I, CATENTRY.FIELD2 X_FIELD2_I, CATENTRY.FIELD3 X_FIELD3_D, 
    CATENTRY.FIELD4 X_FIELD4_Q, CATENTRY.FIELD5 X_FIELD5_SM, CATENTDESCOVR.FIELD1 X_FIELD1_NL_I, CATENTDESCOVR.FIELD2 X_FIELD2_NL_Q, 
    TI_RATING.RATING, CATENTDESCOVR.FIELD3 X_FIELD3_NL_S FROM CATENTRY INNER JOIN TI_CATENTRY_#INDEX_SCOPE_TAG# 
    CE ON (CATENTRY.CATENTRY_ID=CE.CATENTRY_ID) LEFT OUTER JOIN CATENTDESCOVR ON (CATENTRY.CATENTRY_ID=CATENTDESCOVR.CATENTRY_ID) 
    LEFT OUTER JOIN TI_RATING ON (CATENTRY.CATENTRY_ID=TI_RATING.CATENTRY_ID))" 
    name="X_VI_CE_#INDEX_SCOPE_TAG#_#lang_tag#"/>
  4. Save and close the file.
  5. Change to the search-config-ext\src\index\managed-solr\config\v3\CatalogEntry directory, and open the x-data-config.xml file for editing.
  6. Add the following field declaration mappings to map the field from the database to the index field that defined in the x-schema.xml file.
    <field column="RATING" name="customerRanking"/>
  7. Save and close the file.