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

  1. In your file manager utility, go to the search-config-ext/index/managed-solr/config/v3/CatalogEntry/ directory.
  2. Open the x-schema.xml file for editing. You must use this file to extend the schema.xml file for field, fieldType, and copyField configurations.
  3. Add the following field configurations into the x-schema.xml.
    
    <field name="profitMargin" type="tfloat" indexed="true" stored="true" multiValued="false" />
    
    Where
    • 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 to compare products with a profit margin, "profitMargin", greater than 75.
    • 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 the stored 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 the profitMargin field that is provided by default, use the field instead of creating a new field. If you did already use the profitMargin 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.
  4. Save and close the file. In the following lessons, you use this index field to store the profit margin data.