Customizing search profiles

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

To create a new search profile, add a new profile to the wc-search.xml file in the following directory. If the directory does not exist, create it: WC_installdir\workspace\WC\xml\config\com.ibm.commerce.catalog-ext

The following example shows how a new search profile that extends an existing search profile is defined and customized:

1
<_config:search-config
xmlns:_config="http://www.ibm.com/xmlns/prod/commerce/foundation/config"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
xsi:schemaLocation="http://www.ibm.com/xmlns/prod/commerce/foundation/config ../xsd/wc-search.xsd ">
2
<_config:profile name="X_findCatalogEntryByfield1"
extends="IBM_findCatalogEntryWithoutDescriptionByNameAndShortDescription">
<_config:query inherits="true">
3
<_config:field name="catentry_field1" />
4
<_config:provider classname="com.mycompany.commerce.catalog.facade.server.services.search.expression.solr.CustomSolrSearchExpressionProvider"/>
5
<_config:preprocessor classname="com.ibm.commerce.foundation.internal.server.services.search.query.solr.SolrSearchCustomQueryPreprocessor"/>
<_config:postprocessor classname="com.ibm.commerce.catalog.facade.server.services.search.query.solr.SolrSearchCustomQueryPostprocessor" />
</_config:query>
6
<_config:result>
<_config:field name="catentry_field3"/>
<_config:field name="catentry_field5"/>
7
<_config:filter classname="com.ibm.commerce.catalog.facade.server.services.search.metadata.CustomSearchResultFilter"/>
</_config:result>
8
</_config:profile>
</_config:search-config>
  • 1 Default wc-search.xml file content (start)
  • 2 A new search profile that extends an existing search profile is defined.
  • 3 The CatalogEntry customizable field1 is added to the search query.
  • 4 The custom expression provider is included in the search profile.
  • 5 The search query preprocessors and postprocessors are included in the search profile.
  • 6 The customizable fields field3 and field5 are specified to be returned in search results.
  • 7 The custom result filter is included in the search profile.
  • 8 Default wc-search.xml file content (end).

For more information about the default search profiles, see WebSphere Commerce search configuration file (wc-search.xml) (WC EAR).