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
-
In your file manager utility, go to the
solrhome\MC_masterCatalogID\locale\CatalogEntry\conf
directory, where masterCatalogID is your catalog ID and locale
is the language, such as en_US.
The MC_masterCatalogID directory includes the master catalog folder, which includes configuration files for each language.
-
Open the x-schema.xml file for editing. You must use this file to extend
the schema.xml file for
field
,fieldType
, andcopyField
configurations. -
Add the following
field
configurations into the x-schema.xml.
Where<field name="profitMargin" type="tfloat" indexed="true" stored="true" multiValued="false" />
- The
field
element is of typetfloat
to improve performance when you use arithmetical operations. This field is used for comparisons during product recommendation, such as to compare products with a profit margin,"profitMargin"
, greater than75
. - The
stored
attribute is set to"true"
, which indicates that the original information is stored in the search index. If you want to retrieve a field for display on the storefront, set thestored
attribute with a value of"true"
. Otherwise, customers can only search the field. By default, this attribute is set to"false"
. For more informaiton, see Structured content. - The name is
"profitMargin"
. If you did not already use theprofitMargin
field that is provided by default, use the field instead of creating a new field. If you did already use theprofitMargin
field, then create you must create a field with a different name, for instance,"MyCompanyProfitMargin"
. By default, the search schema.xml file that you are extending defines some index field names. No functionality is associated with these names, so you can use the names when you create your customization.
- The
- Save and close the file. In the following lessons, you use this index field to store the profit margin data.