Feature Pack 2

Example: Indexing catalog entry long descriptions

In this example, WebSphere Commerce search is customized to index long descriptions for catalog entries.

Introduced in Feature Pack 3Note: Catalog entry long descriptions are indexed by default.

Procedure

  1. Configure the Data Import Handler mapping.
    1. Go to the following directory:
      • WebSphere Commerce DeveloperWCDE_installdir/search/solr/home
      • SolarisLinuxAIXWindowsWC_installdir/instances/instance_name/search/solr/home

      This directory contains the Master Catalog folder, in which there are the configurations files for each language. If you have more than one language folders, perform this step for every language.

    2. Open the MC_masterCatalogId/en_US/CatalogEntry/conf/schema.xml file.
    3. Locate <field name="name_ntk" type="wc_keywordTextLowerCase" indexed="true" stored="false" multiValued="false"/> and add the following snippet in bold.
      
      <!--
         Catentry's description: map to table CATENTDESC
         -->
         <field name="name" type="wc_text" indexed="true" stored="true"  multiValued="false"/> 
         <field name="shortDescription" type="wc_text" indexed="true" stored="true"  multiValued="false"/>
         <field name="thumbnail" type="string" indexed="false" stored="true"  multiValued="false"/> 
         <field name="fullImage" type="string" indexed="false" stored="true"  multiValued="false"/>
         <field name="keyword" type="wc_text" indexed="true" stored="false"  multiValued="false"/>
         
         <field name="name_ntk" type="wc_keywordTextLowerCase" indexed="true" stored="false" multiValued="false"/> 
         
         <field name="xf_longDescription" type="wc_text" indexed="true" stored="true"  multiValued="false"/>
      
    4. Save your changes.
    5. Open the MC_masterCatalogId/en_US/CatalogEntry/conf/wc-data-config.xml file.
    6. Locate <document name="CatalogEntry"> for both the query and deltaImportQuery sections.
    7. Add the following columns and tables in bold to all the select SQL:
      
      SELECT CATENTRY.CATENTRY_ID,CATENTRY.MEMBER_ID,CATENTRY.CATENTTYPE_ID,CATENTRY.PARTNUMBER,CATENTRY.MFPARTNUMBER,CATENTRY.MFNAME, CATENTRY.BUYABLE,
      											STORECENT.STOREENT_ID, 
      											CATENTDESC.NAME,CATENTDESC.SHORTDESCRIPTION,CATENTDESC.THUMBNAIL,CATENTDESC.FULLIMAGE, CATENTDESC.KEYWORD, CATENTDESC.PUBLISHED,
      											CATENTDESC.LONGDESCRIPTION,
      											TI_DPGROUP.CATGROUP DPCATGROUP,
      											TI_APGROUP.CATGROUPS APCATGROUP,
      											TI_PRODUCTSET.PRODUCTSET,
      
      Add the field mapping for all <field column="PUBLISHED" name="published" />:
      
      <field column="PUBLISHED" name="published" />
          <field column="LONGDESCRIPTION"  clob="true"/>
          <field column="LONGDESCRIPTION" name="xf_longDescription" />
      
    8. Save the changes and close the file.
  2. Restart the WebSphere Commerce search server.
  3. Run the di-buildindex utility.
  4. Verify the data:
    • WebSphere Commerce Developerhttp://localhost/solr/MC_10101_CatalogEntry_en_US/select?q=*:*
    • SolarisLinuxAIXWindowshttp://yoursolrserverhost:3737/solr/MC_10101_CatalogEntry_en_US/select?q=*:*
    There are two ways to search newly added catalog fields:
    • Insert a copyField statement in the MC_masterCatalogId/en_US/CatalogEntry/conf/schema.xml file to copy the new field into the defaultSearch field, and reindex.
      <copyField source="xf_longDescription" dest="defaultSearch"/>
    • Modify the search profile query fields to add the new field, and reindex. For more information about modifying search profile query fields, see Customizing search profiles.
    Sample snippet
    
    <str name="xf_longDescription">Get ready for your busy day with a cup of home-brewed coffee from this amazing coffee bundle.
    The aroma of coffee will fill your senses and allow you to energize your mind and body for the day.</str>