Feature Pack 6

Updating the search schema

In this lesson, the search schema is reviewed before you continue customizing WebSphere Commerce search. In this tutorial, the profitMargin field is used.

Procedure

  1. Go to the following directory:
    • SolarisLinuxAIXWindowsWC_installdir/instances/instance_name/search/solr/home/MC_masterCatalogId
    • WebSphere Commerce DeveloperWCDE_installdir/search/solr/home/MC_masterCatalogId
    Where masterCatalogId is the ID of the master catalog, for example, MC_10001.

    The MC_masterCatalogId directory contains the master catalog folder, in which there are the configurations files for each language.

  2. Open the schema.xml file for English under en_US/CatalogEntry/conf directory.
  3. Note the following default defined field element. The profitMargin field is included in the schema.xml file for customization purposes.
    <field name="profitMargin" type="tfloat" indexed="true" stored="false" multiValued="false" />
    The field element is of type tfloat to improve performance when you use arithmetical operations. This field is used for comparisons during product recommendation, such as profitMargin > 75
  4. The stored attribute of the field is set to false by default. You must set this value to true to retrieve the field for display. Otherwise, you can search only on the field. For more information, see Structured content.
    By default, the search schema.xml file defines some index field names. However, no functionality is associated with the names, so you can use them when you create your customization. If you did not already use the profitMargin field that is provided by default, use this field instead of creating one. If you did already use the profitMargin field, then create a field.
    OptionDescription
    If you did not already use profitMargin field, Ensure that your modified field resembles the following code:
    <field name="profitMargin" type="tfloat" indexed="true" stored="true" multiValued="false" />
    If you did already use profitMargin field, Create a separate field for this tutorial to avoid affecting your previous customization. For example, you can name the field MyCompanyProfitMargin.
    <field name="MyCompanyProfitMargin" type="tfloat" indexed="true" stored="true" multiValued="false" />
    In the following lessons, you use this index field to store the profit margin.