Redefining an existing search profile to override default properties
You can override default properties in the wc-search.xml file to add, change, or remove the behavior of default properties.
Before you begin
- Identify the search profile to customize.
- Identify the property that you want to add or change.
About this task
- Add a new parameter, field, provider, processor, or configuration into an existing configuration. All additions are appended to the end of the default configurations.
- Override an existing configuration parameter values in any profile configuration, where applicable.
- Disable any of the default providers or processors.
- Disable a sort configuration field.
Procedure
- Copy the contents of the entire search profile that you want to customize into your extended wc-search.xml file.
- Keep all of the elements that you want to update, and remove the ones that do not require changes.
-
To add a new parameter, field, provider, processor, or configuration, add it directly into its
specific configuration.
For example, the following snippet adds the searchType parameter, x-name field, and a sample post processor into the query configuration of the IBM_findProductsBySearchTerm search profile:
<_config:profile name="IBM_findProductsBySearchTerm" indexName="CatalogEntry"> <_config:query> <_config:param name="searchType" value="10"/> <_config:field name="x_name"/> <_config:postprocessor classname="com.mycompany.commerce.catalog.facade.server.services.search.query.solr.SolrRESTSearchSampleQueryPostprocessor" /> </_config:query> </_config:profile>
-
To override an existing configuration parameter, include the parameter and set it to a
different value.
For example, the following snippet overrides the DynamicKitReturnPrice query parameter of the IBM_findProductsByCategory search profile:
<_config:profile name="IBM_findProductsByCategory" indexName="CatalogEntry"> <_config:query> <_config:param name="DynamicKitReturnPrice" value="false"/> </_config:query> </_config:profile>
-
To disable any of the default providers or processors, include the same class you want to
disable and set the enabled property to false.
For example, the following snippet disables the catalog entry sequencing provider from the IBM_findProductsByCategory search profile:
<_config:profile name="IBM_findProductsByCategory" indexName="CatalogEntry"> <_config:query> <_config:provider classname="com.ibm.commerce.foundation.server.services.rest.search.expression.solr.SolrRESTSearchProductSequencingExpressionProvider" enabled="false" /> </_config:query> </_config:profile>
-
To disable a sort field, list the sort field without a value.
For example, the following snippet removes the sort field with name 2, and overrides the sort field 1 value to use different index field:
<_config:profile name="IBM_findProductsByCategory" indexName="CatalogEntry"> <_config:sort> <_config:field name="1" value="x-mfName_ntk_cs asc"/> <_config:field name="2"/> </_config:sort> </_config:profile>
- Save the changes to your extended wc-search.xml file.
- Restart the search server.