Feature Pack 7 or later

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

To understand the properties that this file contains, see WebSphere Commerce search configuration file (wc-search.xml) (WC EAR).

About this task

In your custom wc-search.xml file, change the following node types.
  • <_config:profile>
  • <_config:queryMapping>
Note: To add or remove a configuration within an existing search profile, add a new profile in your custom wc-search.xml file that extends the existing profile you want to modify. For more information, see the example in the tutorial Adding the new search profile.

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

  1. Open WebSphere Commerce Developer and switch to the Enterprise Explorer view.
  2. Create a custom WebSphere Commerce search configuration file (wc-search.xml) if one does not exist:
    1. Go to the following path: WCDE_installdir\workspace\Search\xml\config\
    2. In the config folder, create a com.ibm.commerce.catalog-ext folder: WCDE_installdir\workspace\Search\xml\config\com.ibm.commerce.catalog-ext\

      If this folder exists and it contains a custom version of the wc-search.xml file, then open the file and skip to step 4.

    3. Create an empty wc-search.xml file in the com.ibm.commerce.catalog-ext folder. This file is your custom wc-search.xml file.
  3. Add the basic XML elements in your custom wc-search.xml file:
    1. Open your empty custom wc-search.xml file in an XML editor.
    2. 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:server name="BasicConfiguration">
      		<_config:embedded />
      	</_config:server>
      
      </_config:search-config>
  4. Add the XML for any properties that you want to change to your custom wc-search.xml file:
    1. Go to the default WebSphere Commerce search configuration file at the following path: WCDE_installdir\workspace\Search\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.

    2. 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, to change the property that is defined in a specific <_config:param> element, retain the parent and ancestor elements of the <_config:param> element, but delete all the siblings. 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. For an example, see Example: Custom wc-search.xml file.

    3. Change the values for the copied properties.
    4. Preceding 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 are properly merged between the two files. For an example, see Example: Custom wc-search.xml file.

  5. Save and close your custom wc-search.xml file.
  6. Test your configuration changes.
  7. Deploy the customized file to the production environment.

Example: 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: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 that starts 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 that starts 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.