Updating the search schema
In this lesson, the search schema is reviewed before you continue customizing HCL Commerce search. In this tutorial, the profitMargin field is used.
Procedure
- In your file manager utility, go to the search-config-ext/index/managed-solr/config/v3/CatalogEntry/ directory.
-
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 information, 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.