Example: Indexing catalog entry long descriptions
In this example, WebSphere Commerce search is customized to index long descriptions for catalog entries.
Note: Catalog entry long descriptions are indexed by default.
Procedure
-
Configure the Data Import Handler mapping.
-
Go to the following directory:
- WCDE_installdir/search/solr/home
- WC_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.
- Open the MC_masterCatalogId/en_US/CatalogEntry/conf/schema.xml file.
-
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"/>
- Save your changes.
- Open the MC_masterCatalogId/en_US/CatalogEntry/conf/wc-data-config.xml file.
-
Locate
<document name="CatalogEntry">
for both thequery
anddeltaImportQuery
sections. -
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" />
- Save the changes and close the file.
-
Go to the following directory:
- Restart the WebSphere Commerce search server.
- Run the di-buildindex utility.
-
Verify the data:
http://localhost/solr/MC_10101_CatalogEntry_en_US/select?q=*:*
http://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.