Salesforce B2C Commerce 19.2 > Merchandising Your Site > Search > Sorting Rules

Create Sorting Rules

Sorting rules enable you to control the presentation of search results to the customer. You can use sorting rules to bring products to the attention of customers by having them appear at the top of search results. You can use any attribute to sort search results or a weighted blend of multiple attributes by creating dynamic attributes. See How Sorting Rules Work.
  1. Select site > Merchant Tools > Search > Sorting Rules.
    The Sorting Rules page opens with the Sorting Rules tab open. On this tab, you create or edit your sorting rules.
  2. To create a new sorting rule, click New.
    The page has three sections: Sorting Rules, Attributes, and Preview.
    A new sorting rule appears with the default rule ID highlighted.
  3. Enter a unique rule ID and description.
    You use the description to identify the rule when selecting sorting rules for categories and storefront options.
  4. Choose whether you want the context of the rule to be site specific, or globally applied.
  5. Click Add in the Attributes section to add a new attribute for your rule.
  6. Enter the attribute to sort by or select an attribute from the list. You can select the following types of attributes:
    • Standard attributes: Standard attributes enable you to intervene in sorting using explicit placement of search results for categories, based on specific attributes intended for search ranking or availability.
    • Product attributes: You can select any attribute of the product system object to use in a sorting rule, as long as it is not a Password, Image, Text, HTML, or Email type of attribute. Product attributes don't have to be flagged as online or searchable to be used in sorting rules.
    • Active Data attributes: These attributes require the active merchandising feature to be implemented for the attribute data to be useful in sorting. These attributes include data collected from orders on your production system and information collected from storefront pages.
    • Availability model attributes: These attributes require the availability, active merchandising, or both features to be implemented for the attribute data to be useful in sorting.
    • Dynamic attributes: Dynamic attributes are custom combinations of attributes that are created by the merchant.

    All system attributes are listed as Name (type.ID). All custom attributes are listed as Name (type.custom.ID). Because it's possible to have multiple attributes with the same name, check to make sure that you are selecting the correct attribute type and ID in addition to the correct name.

  7. In the Text Relevancy column, click in the cell for your attribute and select whether you want to use text relevancy in combination with the attribute, using one of the following options:
    • Yes: The text relevance score (from 0 through 1) is multiplied by the score of the attribute selected for the rule.  This is the equivalent of a 50%-50% weighting between the selected attribute and the text relevance score. This is appropriate when there are multiple items that might have the same score from the sorting attribute, such as a recommendations sort, or when it's not readily apparent to the user that more than just the selected attribute is being used for sorting, such as a sorting for best-selling items. For example, if you have a sorting rule that sorts by a 1–5 star customer rating, selecting Yes for text relevancy is identical to selecting the Text Relevance standard attribute to directly follow the review rating attribute in the sorting rule. Because you can't use the Text Relevance standard attribute twice in the same rule and have a limited number of sorting attributes in a rule, this can be very useful.
    • No: Only the score for the attribute selected for the rule is used. This is appropriate when it's unlikely that multiple items have the same score or when the customer expects the results to be sorted only by the selected attribute.
    • N/A: Displays if the selected attribute can't use text relevancy.
  8. In the Direction column, click in the cell for your attribute and select the direction of the sort. Some attributes do not let you select direction, because it's implied by the attribute. For example, Category Position automatically sorts items in ascending order.
    • Ascending: Sorts the results from top to bottom in the search results from the lowest value to the highest (A-Z, 1–100).
    • Descending: Sorts the results from top to bottom in the search results from the highest value to the lowest (Z-A, 100-1).
  9. Add any additional attributes and configure them.
  10. Click Apply to save your rule.
    If you change a sorting rule and want to reset it to the last saved value, click Cancel
  11. Preview the results of your new sorting rule in the Preview section. See Previewing Sorting Rules.