WebSphere 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 WebSphere Commerce search configuration
file, wc-search.xml .
To create a search profile, add a profile to the wc-search.xml file in the
WC_installdir \workspace\Search\xml\config\com.ibm.commerce.catalog-ext
directory. If the directory does not exist, create it.
Example of defining and customizing a search profile that extends an existing profile
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>
<_config:result>
6 <_config:field name="catentry_field3"/>
<_config:field name="catentry_field5"/>
7 </_config:profile>
</_config:search-config>
Where:
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.Ensure that the name specified in
config:result
has a mapping defined in the
wc-component.xml file.
Example: Mapping in the wc-component.xml file
<_config:valuemapping externalName="SearchIndexReturnFieldMapping"
internalName="SearchIndexReturnFieldMapping">
<!-- CatalogEntry search index -->
<_config:valuemap externalValue="catentry_field3" internalValue="field3"/>
<_config:valuemap externalValue="catentry_field5" internalValue="field5"/>
7
Default wc-search.xml file content (end).
For more information about the default search profiles, see WebSphere Commerce search configuration file (wc-search.xml) (Search EAR) .