Coveo Date Sort

Warning
Legacy feature

This article pertains to the Coveo Hive framework which is now in maintenance mode.

Choose one of Coveo’s more modern, lightweight, and responsive libraries for any future search interface development. See the search interface Implementation guide for more details.

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).

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 dropdown 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.

  • See List result sort options in a dropdown menu for more details about managing sort direction captions when displaying sort options in a dropdown menu.

  • You can customize the CSS associated with this rendering.

Insertion location

Coveo Hive

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 Hive SXA

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

The following table lists the available data source options for this rendering.

Option name Description

Caption

See the caption component option.

Sort direction

See the sortCriteria component option.

Enable sort direction toggle

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 | Coveo for Sitecore 5