< Previous | Next >

Extend the catalog entry search index schema

In this lesson, the search schema is extended to add ranking fields for the customer ratings data. These customer ranking fields are used to index customer ratings as XML input data from an external source.


Procedure

  1. In your file manager utility, go to the workspace_dirsearch-config-ext\src\index\managed-solr\config\v3\CatalogEntry directory.

  2. Open the x-schema.xml file for editing. We must use this file to extend the schema.xml file for field, fieldType, and copyField configurations.

  3. Add the following field and copyField configurations into the x-schema.xml.

      <field name="customerRanking" type="tfloat" indexed="true" stored="false" multiValued="false" />
      <field name="customerRanking_display" type="float" indexed="true" stored="true" multiValued="false" />
      <copyField source="customerRanking" dest="customerRanking_display"/>

    • The customerRanking field is used for comparison purposes during search operations, such as searches for products that have a customer rating higher than 5 (out of 10). This field is of type "tfloat" for improved performance during any arithmetical operations.

    • The customerRanking_display field is used in retrieving search results to display items on the storefront to customers. This field is of type "float" since the performance of casting float to string, such as for retrieving and displaying search results, is better than type "tfloat".

    When the stored attribute is set to "true" for a field, the original information is stored in the search index. Since this information is stored, defining the field to be tokenized or non-tokenized is irrelevant. 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. See Structured content.

    You use this customer ranking field in following lessons to store the ratings data that is retrieved from an external XML file.

  4. Save and close the file.

< Previous | Next >