Configuring parametric search to search on custom data

Before new properties can be used as search conditions in the query template, you must define the object path mapping. By defining the object path mapping, the query can distinguish the object path as the corresponding column in the database table.

About this task

Define this mapping in a wc-component.xml file that is contained in the WC_eardir/xml/config/com.ibm.commerce.catalog-ext extension directory.

This file should exist in this directory after it is created in Part 1 of Tutorial: Adding fields in the Catalogs tool .

In that previous tutorial, the warranty type and warranty term properties were added to the logical model by using UserData. To use this in the search, explicitly define the object path of UserData as UserData/UserDataField/ property name . To add mapping sections:

Procedure

  1. Open WebSphere Commerce Developer.
  2. In the Enterprise Explorer view , navigate to WC > xml > config > com.ibm.commerce.catalog-ext and double-click the wc-component.xml file to open it in the default editor.
  3. Locate the _config:dataservice and add the mapping section to it. The following example displays the updated code after the mapping section is added:
    
    <_config:dataservice dataMediatorType="JDBC" 
                          metadataClass="com.mycompany.commerce.catalog.facade.server.metadata.MyCompanyMetaData">
    
      <_config:mapping>
        <_config:key name="CatalogEntry" />
        <_config:basetable name="CATENTRY" useAllColumns="false">
          <_config:associatedtable name="XWARRANTY" useAllColumns="false">
            <_config:columns name="WARTERM" propertyName="UserData/UserDataField/Warterm" caseSensitive="false" />
            <_config:columns name="WARTYPE" propertyName="UserData/UserDataField/Wartype" caseSensitive="false" />
          </_config:associatedtable>
        </_config:basetable>
      </_config:mapping>
    
    </_config:dataservice>
    
  4. Click Save. The following example is provided in the wc-component.xml file:
    
    <?xml version="1.0" encoding="UTF-8"?>
    <_config:DevelopmentComponentConfiguration
    	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-component.xsd ">
    	<_config:dataservice dataMediatorType="JDBC"
    		metadataClass="com.mycompany.commerce.catalog.facade.server.metadata.MyCompanyMetaData">
    		
    		<_config:mapping>
    			<_config:key name="CatalogEntry" />
    			<_config:basetable name="CATENTRY" useAllColumns="false">
    				<_config:associatedtable name="XWARRANTY"
    					useAllColumns="false">
    					<_config:columns name="WARTERM"
    						propertyName="UserData/UserDataField/Warterm"
    						caseSensitive="false" />
    					<_config:columns name="WARTYPE"
    						propertyName="UserData/UserDataField/Wartype"
    		    				caseSensitive="false" />
    				</_config:associatedtable>
    			</_config:basetable>
    		</_config:mapping>
    		
    	</_config:dataservice>
    </_config:DevelopmentComponentConfiguration>
    
  5. Restart the WebSphere Commerce Test Server to load the new configuration.