Change properties in the component configuration file (wc-component.xml)
To change any properties in the configuration file (wc-component.xml), we 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 beginning
To understand the search-related properties that this file contains, see Search properties in the component configuration file (wc-component.xml).
Procedure
- Open WebSphere Commerce Developer and switch to the Enterprise Explorer view.
- Expand the search-config-ext project, then the src.runtime.config folder.
- In the src.runtime.config folder, create a new com.ibm.commerce.component_name folder, where component_name can be either "foundation" or "search." To determine which configuration file to use, look in the wc-component.xml file under Search_home\resources\search\runtime\config.
If this folder exists and it contains a customized version of the wc-component.xml file, then open the file and skip to step 4.
- Create an empty wc-component.xml file in the com.ibm.commerce.component_name folder. This file is our custom wc-component.xml file.
- Add the basic XML elements required for our custom wc-component.xml file:
- Open your empty custom wc-component.xml file in an XML editor.
- Copy the following code into the file:
<?xml version="1.0" encoding="UTF-8"?> <_config:DevelopmentComponentConfiguration xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.ibm.com/xmlns/prod/commerce/foundation/config ../xsd/wc-component.xsd " xmlns:_config="http://www.ibm.com/xmlns/prod/commerce/foundation/config"> <_config:extendedconfiguration> </_config:extendedconfiguration> </_config:DevelopmentComponentConfiguration>
- Add the XML for any properties to change to our custom wc-component.xml file:
- Go to the default component configuration file:
Search_home\resources\search\runtime\config\com.ibm.commerce.component_name\wc-component.xml Never change properties directly in this file because our changes will be overwritten with future IBM software updates.
- Copy the XML elements for the properties we want to change from the default component configuration file to our custom wc-component.xml file. Insert the copied XML elements after the <_config:extendedconfiguration> element.
Even though we are copying only certain elements, we must maintain the XML hierarchy for those elements in the file. For example, to change the property that is defined in a specific <_config:property> element, we must retain the parent and ancestor elements of the <_config:property> element, but we can delete all the siblings if we are not changing them. We 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.
- Save and close the custom configuration file.
- Test the configuration changes.
Example 1: Custom catalog component configuration file that changes search configuration properties
<?xml version="1.0" encoding="UTF-8"?> <_config:DevelopmentComponentConfiguration xmlns:xsi = "http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation = "http://www.ibm.com/xmlns/prod/commerce/foundation/config ../xsd/wc-component.xsd " xmlns:_config = "http://www.ibm.com/xmlns/prod/commerce/foundation/config"> <_config:extendedconfiguration> A <_config:configgrouping name = "SearchConfiguration"> <_config:property name = "SearchProfilesStatistics" value = "true"/> <_config:property name = "SearchStatisticsUpdateInterval" value = "4800"/> <_config:property name = "SearchStatisticsResultPagesTrackingThreshold" value = "2"/> <_config:property name = "relevancyType" value="1"/> </_config:configgrouping> B </_config:extendedconfiguration> </_config:DevelopmentComponentConfiguration>In the previous example, the code snippet that starts with A and ends with B is the inserted code, which contains the following properties:
- SearchProfilesStatistics
- The value is changed to true to enable site search statistics.
- SearchStatisticsUpdateInterval
- The value is changed to 4800 seconds as the time interval between batch processing updates.
- SearchStatisticsResultPagesTrackingThreshold
- The value is changed to 2 search results pages to track search rule statistics.
- relevancyType
- The property relevancyType is set to 1 to enable the category search relevancy feature.