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
- Go to the following directory:
- WC_installdir/instances/instance_name/search/solr/home/MC_masterCatalogId
- WCDE_installdir/search/solr/home/MC_masterCatalogId
The MC_masterCatalogId directory contains the master catalog folder, in which there are the configurations files for each language.
- Open the schema.xml file for English under en_US/CatalogEntry/conf directory.
- Note the following default defined field element. The profitMargin
field is included in the schema.xml file for
customization purposes.
The<field name="profitMargin" type="tfloat" indexed="true" stored="false" multiValued="false" />
field
element is of typetfloat
to improve performance when you use arithmetical operations. This field is used for comparisons during product recommendation, such as profitMargin > 75 - 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.
Option Description 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.