Facet Sorting

I need some help sorting facets alphabetically rather than by count. I am using the reference UI react project but I am struggling to find where I can set the sort option.

I found that you can do it directly in the API but I don't see the option in reference UI project.

{ "query": "", "facets": { "specialty": [ { "type": "value", "name": "specialty", "sort": { "value": "asc" }, "size": 10 } ] } }

I figured it out. In the app.js modify the config variable and set the sort options there.

'const config = {
searchQuery: {
facets: {
cities: { type: "value", "sort": { "value": "asc" } },
counties: { type: "value", "sort": { "value": "asc" } },
gender: { type: "value", "sort": { "value": "asc" } },
},
...buildSearchOptionsFromConfig()
},
autocompleteQuery: buildAutocompleteQueryConfig(),
apiConnector: connector,
alwaysSearchOnInitialLoad: true,
};'

1 Like

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.