Sorting in facets




I have a facet called “Draad Afmeting” but the values of this one look like they are sorted randomly when I am searching in the facet

See when I am searching for the value “1”. It shows 10s before 1s. Can I sort this somehow?


Hi @robbert,

Perhaps the default sort of the refinementList is not working will with the values available (such as “1”, “10”, “1/2”) because they are not just all alphabetical or all numeric.

If you are using an InstantSearch library, you can provide a custom function to the sortBy option of the RefinementList to control how the sort works. For example, you might fix the order based on your known facet values. The function behaves like the regular sort function of a JavaScript array.

Here is an example on how to use it.

Hope that helps.