Changing properties in the WebSphere Commerce Search configuration file (wc-search.xml) (Search EAR)
To change the value of an existing property in the WebSphere Commerce Search configuration file (wc-search.xml), you must create a customized version of the file in a new folder. The customized version of the file must contain only the changed properties.
Before you begin
About this task
<_config:profile>
and <_config:queryMapping>
node
types.The following procedure can be used to change (rather than add or remove) a value of an existing property within a search profile, which is defined in the wc-search.xml file.
Procedure
- Open WebSphere Commerce Developer and switch to the Enterprise Explorer view.
-
Create a custom WebSphere Commerce Search configuration file
(wc-search.xml) if one does not exist:
-
Add the basic XML elements in your custom wc-search.xml file:
-
Add the XML for any properties that you want to change to your custom
wc-search.xml file:
- Save and close your custom wc-search.xml file.
- Test your configuration changes.
- Deploy the customized file to the production environment.
Example 1: Changing properties in the custom wc-search.xml file
The following example shows the contents of a custom wc-search.xml file that
changes three properties that are defined within the IBM_Global
profile:
<?xml version="1.0" encoding="UTF-8"?>
<_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 ">
<_config:server name="BasicConfiguration">
<_config:embedded />
</_config:server>
A
<_config:profile indexName="CatalogEntry" name="IBM_Global">
<_config:query>
<_config:param name="price" value="0" />
<_config:param name="statistics" value="true"/>
</_config:query>
<_config:spellcheck>
<_config:param name="limit" value="3"/>
</_config:spellcheck>
</_config:profile>
B
</_config:search-config>
price
: The property value is changed from1
to0
.statistics
: The property value is changed fromfalse
totrue
.limit
: The property value is changed from5
to3
.
<_config:param>
element are retained in the custom wc-search.xml file.You can define a new custom search profile to meet your business needs. The custom search profile can be modeled off an existing profile and can include both default and custom implementations. A common scenario where you might define custom profiles is when none of the default profiles meet your business needs. Or, when you want certain logic to run before other logic. For example, by defining a new custom provider which must run before any of the default providers or processors.
The new search profile must comply to the wc-search.xml file XML schema definition. The advantage of defining a new profile is that you have full control over how the profile is designed. However, if the profile is meant to be used by an external REST resource method, you must map it to a REST resource method in the wc-rest-resourceconfig.xml file.
- In your extended wc-search.xml file, define the
config:profile opening and closing elements, with the mandatory name and
indexName attributes. For
example:
<_config:profile name="X_findProductsBySearchTerm" indexName="CatalogEntry"> </_config:profile
- Add the different required configurations such, as query, facet, and result. For
example:
<_config:profile name="X_findProductsBySearchTerm" indexName="CatalogEntry"> <_config:query> List of all parameters, providers, fields, preprocessors, and post processors in their expected order </_config:query> <_config:result> List all of the result fields </_config:result> </_config:profile>
- Register the new custom search profile in the Search-Rest/wc-rest-resourceconfig.xml file.