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.
About this task
In your custom wc-search.xml
file, you should make changes to the
following node types only:

<_config:profile>
nodes

<_config:profile>
and
<_config:queryMapping>
nodes
To add new elements to any of the existing profiles in wc-search.xml
file, add a new profile in your custom wc-search.xml file that extends the
existing profile. See the tutorial example in Adding the new search profile.
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
already exist:
-
Navigate to the following path:
WCDE_installdir\workspace\WC\xml\config\
-
In the config folder, create a
new
com.ibm.commerce.catalog-ext
folder so the path looks like this:
WCDE_installdir\workspace\WC\xml\config\com.ibm.commerce.catalog-ext\
If
this folder already exists and it contains a
custom version of the
wc-search.xml file,
then open the file and skip to step 4.
-
Create an empty wc-search.xml
file in the
com.ibm.commerce.catalog-ext
folder. This file is your custom
wc-search.xml file.
-
Add the basic XML elements required for your custom
wc-search.xml file:
-
Open your empty custom
wc-search.xml file in an
XML editor.
-
Copy the following code into the file:
<?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:search-config>
Note: You cannot disable an existing configuration by copying statements to the
catalog-ext version of the wc-search.xml file and
commenting them out in that version. At run time this version of the file is merged with its
original in the -fep directory. Commenting out a statement in the
-ext version of the file does not comment it out of the original
-fep version.


If you have installed APAR JR44946, copy the following code
into the file:
<_config:profile indexName="CatalogEntry" name="IBM_findNavigationSuggestion_Brands">
<_config:query>
<_config:param name="searchType" value="12"/>
</_config:query>
</_config:profile>
-
Add the XML for any properties that you want to change to
your custom wc-search.xml file:
-
Navigate to the default WebSphere Commerce search
configuration file at the following path:
WCDE_installdir\workspace\WC\xml\config\com.ibm.commerce.catalog-fep\wc-search.xml
Never
change properties directly in this file because
your changes will be overwritten with future IBM
software updates.
-
Copy the XML elements for the properties you want
to change from the default WebSphere Commerce search
configuration file to your custom
wc-search.xml file. Insert
the copied XML elements above the
</_config:search-config>
element.
Even though you are copying only certain
elements, you must maintain the XML hierarchy
for those elements in the file. For example, if
you want to change the property defined in a
specific <_config:param>
element, you must retain the parent and ancestor
elements of the
<_config:param>
element,
but you can delete all the siblings if you are
not changing them. You must also maintain the
ordering of the siblings, as they are expected
in the same order that they appear in the
default configuration file. See the example at
the end of this topic.
-
Change the values for the copied properties as
required.
-
Above the
</_config:search-config>
element, add a list of the profiles that inherit
directly or indirectly from the profile for which
you changed property values.
Search profiles have a hierarchical structure.
The default wc-search.xml
file
contains a number of profiles that inherit
elements directly and indirectly from other
profiles. For example, the
IBM_Global
profile has a
number of profiles that inherit from it. To
ensure that the values you change are picked up
by the extended profiles, you must include a
list of these profiles in your custom
wc_search.xml
file. By
including this list, the property values you
change will be properly merged between the two
files. You can view an example of this profile
list at the end of this topic (see the code
snippet between the letters
B and
C).
-
Save and close your custom
wc-search.xml file.
-
Test your configuration changes.
-
Deploy the customized file to the production
environment.
Example
The following example shows the
contents of a custom wc-search.xml file
that changes three properties 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 ">
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:profile extends="IBM_Global" name="IBM_findCatalogEntryByName"/>
<_config:profile extends="IBM_findCatalogEntryByName" name="IBM_findCatalogEntryByNameAndShortDescription"/>
<_config:profile extends="IBM_findCatalogEntryByNameAndShortDescription" name="IBM_findCatalogEntryByNameAndShortDescriptionInDetail"/>
<_config:profile extends="IBM_Global" name="IBM_findCatalogEntryByUnstructureField"/>
C
</_config:search-config>
In
the previous example, the code snippet starting with
A and ending with
B is the inserted code that
changes three properties:
price
: The property value is changed
from 1
to 0
.
statistics
: The property value is
changed from false
to
true
.
limit
: The property value is changed
from 5
to 3
.
Notice that the parent and ancestor elements of each
<_config:param>
element are retained in
the custom
wc-search.xml file.
The
code snippet starting with B and
ending with C is the list of
profiles that extend directly and indirectly from the
IBM_Global
profile. This snippet is
included to ensure that the changed property values are picked
up by these profiles.