Gravatar for

Question by Marshall_Smith, Feb 25, 2019 10:15 PM

Coveo Hive - Custom Facet Sort Options


I have some facet values that start with numbers and are not sorting correctly since they are sorting as a strings (ex... 1 IN, 10 IN, 12 IN, 2 IN, 22 IN, 3 IN, 4 IN...). What are the options for customizing how facet values are sorted? I found the article below from 3 years ago. Is that still the way it's done? I'm using Coveo 5.

Coveo for Sitecore version:

Sitecore version:


1 Reply
Gravatar for

Answer by Jean-François L'Heureux, Feb 26, 2019 2:27 PM

The solution you found is still valid with recent Coveo for Sitecore versions.

In Coveo for Sitecore v5 with Coveo for Sitecore Hive, the UI components are now MVC renderings. So the file names and items to duplicate would be different.

With Coveo for Sitecore Hive, the initialization happens only when the DOM is loaded. Another approach is to alter the data attributes values before initialization. See

You must set a fixed `DOM Unique Id` value in your facet data source item. E.g.: `sizeFacet`.

Your script would be inserted on the page after the facet component and would look like this:

  var sizeFacet = document.getElementById("sizeFacet");
  sizeFacet.dataset.customSort = "1 IN,2 IN,3 IN...";
Ask a question