Customizing search profiles

HCL Commerce Search uses search profiles to control the storefront search experience at a page-level. Search profiles group search runtime parameters (search index name, search index fields, expression providers and result filters, paging and sorting), and search feature configurations (text highlight, facets, and spelling correction). Search profiles are defined in the HCL Commerce Search configuration file, wc-search.xml.

To create a search profile, add a profile to the search configuration file (wc-search.xml). To customize an existing search profile, redefine the search profile.

The following examples append the custom field1, field3, and field5 into the existing IBM_findProductsBySearchTerm search profile:


1<_config:profile
    name="IBM_findProductsBySearchTerm" indexName="CatalogEntry">   
2<_config:query>
3<_config:provider  classname="com.mycompany.commerce.catalog.facade.server.services.search.expression.solr.CustomSolrSearchExpressionProvider"/>    
4<_config:field name="catentry_field1" />
5<_config:preprocessor    
    classname="com.ibm.commerce.foundation.internal.server.services.search.query.solr.SolrSearchCustomQueryPreprocessor"/>
6<_config:postprocessor
    classname="com.ibm.commerce.catalog.facade.server.services.search.query.solr.SolrSearchCustomQueryPostprocessor"/>
</_config:query>
7<_config:result>
8<_config:field name="field3"/>
<_config:field name="field5"/>
</_config:result>
</_config:profile>
Where:
1
The existing IBM_findProductsBySearchTerm search profile is redefined.
2
The query configuration of the IBM_findProductsBySearchTerm search profile is redefined.
3
The custom expression provider is added to the search query expressions.
4
The CatalogEntry customizable field1 is added to the search query fields.
5
The search query preprocessors are included in the search query preprocessors list.
6
The search query postprocessors are included in the search query postprocessors list.
7
The result configuration of the IBM_findProductsBySearchTerm search profile is redefined.
8
The customizable fields, field3 and field5 are specified to be returned in search results.
Ensure that the name specified in config:result has a mapping defined in the wc-component.xml file. For example:

<_config:valuemapping externalName="SearchIndexReturnFieldMapping" 
    internalName="SearchIndexReturnFieldMapping">
<!-- CatalogEntry search index -->
<_config:valuemap externalValue="catentry_field3"
    internalValue="field3"/><_config:valuemap externalValue="catentry_field5"
    internalValue="field5"/>

For more information about the default search profiles, see HCL Commerce Search configuration file (wc-search.xml).