Changing properties in the search configuration file (wc-search.xml) (WC 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 <_config:profile> and <_config:queryMapping> node types only.

Tip: To add new elements to any of the existing profiles in wc-search.xml file, you can add a profile in your custom wc-search.xml file that extends the existing profile.

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. Navigate to the following path:

      WCDE_installdir\workspace\WC\xml\config\

    2. 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 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 that are required for 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: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\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.

    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, if you want to change the property that is 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.

    3. Change the values for the copied properties as required.
    4. 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 are properly merged between the two files. You can view an example of this profile list (see the code snippet between the letters B and C).

  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

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 ">
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 ends 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 ends 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.