Use Explicit Sorting

Note: Explicit Sort for Product Index is deprecated. Use the Sorting Rule framework for Product Search and Sorting only.

You might want to create a custom sort for a specific page or section of a page. For example, if you have a custom table or grid and you want to enable sorting on any column of the grid, you might want to simply call the Search pipelet to sort the items. If this is the case, you can create a custom pipeline to do the sorting and configure the default sorting configuration to let you use explicit sortings.

To use explicit sorting:

  1. Select Search > Searchable Attributes.
    Unlike other sorting attributes, which are automatically indexed, but are separate from searchable attributes, sorting attributes passed by pipelines for explicit sorting are not automatically indexed. For this reason, you must make sure any attribute used to sort by in your explicit sorting is included in the searchable attributes for your storefront.
    Note: Because sorting and searchable attributes don't use the same data types, the attributes used for explicit sorting are restricted to the ones common to searchable attributes and sorting attributes. This means, for example, that you can't sort by Date +Time. See Supported Data Types for Search and Sorting Rules .You can't use dynamic attributes in explicit sorting.
  2. Check the attribute in the Product Index Attributes list if you want to sort products, or the Content Index Attributes list if you want to sort content items. If the attribute isn't in either list, click New to add it to the appropriate list.
  3. In Products and Catalogs > Catalogs, find the name of the default sorting rule for the storefront catalog and for the category that includes the page where you want to perform the explicit sorting.
  4. In Search > Sorting Rules, select each of these rules and make sure that they include the Explicit Sortings (sorting.explicit-sortings) attribute. This can be the last attribute used for the sorting rule, so that it's only used if no other sorting rule applies.
    CAUTION:
    The Explicit Sortings attribute must be included in the sorting rule
  5. To sort a search result by a defined sorting attribute, you must pass the attribute ID of the sorting attribute into the Search pipelet. This is a developer task.
Note: Implementing this feature requires application changes.

You can specify that results are returned using a specific sorting rule, using the urlSort method for the SearchModel, ContentSearchModel or ProductSearchModel class, depending on the type of search. You can also specify that results are returned without a sorting option, using the urlDefaultSort method. If you specify a specific sorting rule, such as Price or Product name (A-Z), this takes priority and no further sorting rules are applied.

X Privacy Update: We use cookies to make interactions with our websites and services easy and meaningful, to better understand how they are used and to tailor advertising. By continuing to use this site you are giving us your consent to do this.