Coveo Date Sort

By default, the Coveo Date Sort rendering implements the Coveo JavaScript Search Framework Sort component with the sortCriteria component option set to date <SORT_DIRECTION>. Clicking the Coveo Date Sort search interface button allows the user to switch to search result sorting based on the modified date of the item. Subsequent clicks allow the user to toggle between ascending and descending sort directions (if the Enable both sort directions option is enabled).

Coveo for Sitecore (September 18, 2020)

When the wrapping Results Sorts Section rendering Enable sort dropdown data source option is enabled, the Coveo Date Sort rendering adds one or two date sort items (depending on the Enable both sort directions value) to a sort drop-down list (see the Coveo JavaScript Search Framework SortDropdown component)).

Usage Notes

  • The modified date of the item is stored in the updated Coveo Special Field. All fields in this template are automatically indexed. Therefore, no prior field indexing action is required to be able to use the Coveo Date Sort rendering.

  • Any time you change result sorting (whether by changing the criterion or the sort direction), this triggers a Search API call with the requested sortCriteria in the query parameters.

  • Coveo for Sitecore (September 18, 2020) See List Result Sort Options in a Dropdown for more details about managing sort direction captions when displaying sort options in a drop-down.

Insertion Location

The Coveo Date Sort rendering is an Allowed Control in the following placeholder(s): Sorts

Example insertion sequence for the Coveo Date Sort rendering.

Coveo for Sitecore SXA rendering insertion locations aren’t limited by placeholder Allowed Controls. The Coveo Date Sort rendering may therefore be inserted throughout the partial design, whether in Coveo for Sitecore or Sitecore placeholders.

Example insertion sequence for the Coveo Date Sort rendering.

Data Source Options

Option name Description
Caption See caption component option
Sort direction See sortCriteria component option

Enable sort direction toggle

Coveo for Sitecore (September 18, 2020) Enable both sort directions

Specifies whether to allow sorting in both sorting directions.
DOM unique Id Randomly generated HTML element id.
Additional data attributes Allows use of the Coveo JavaScript Search Framework Sort component options that aren't directly available in the data source.

Sample Generated HTML and Corresponding Visual Output

<div class="coveo-sort-container">
   <span id="coveoe3ef76a3" 
   class="CoveoSort coveo-accessible-button coveo-selected coveo-accessible-button-pressed" 
   data-caption="Date" data-prebind-sort-criteria="sortCriteriaResolver" 
   data-sort-criteria="date descending" data-sc-enable-both-sort-directions="true" 
   data-applied-prebind="true" role="button" aria-label="Sort results by Date" 
   tabindex="0">
      Date
   </span>
</div>

Date sort example gif

What's Next for Me?