#community-help

Setting Alphabetical Ordering for Facets in Typesense

TLDR Sean inquired about setting the ordering of a facet to alphabetical in Typesense. Jason suggested using transformItems or a normal JS array sort on items.

Powered by Struct AI

1

6
26mo
Solved
Join the chat
Sep 30, 2021 (26 months ago)
Sean
Photo of md5-2d5361393096e40eccbe0d4cfa49f7de
Sean
08:32 PM
With Algolia there is an option to set the ordering of a facet to alphabetical. Is there a way to do this with Typesense? I ask because the Refinements component renders selected facet values to the top. Which I think confuses users.
Jason
Photo of md5-8813087cccc512313602b6d9f9ece19f
Jason
08:34 PM
Sean You can configure that behavior using this option in InstantSearch: https://www.algolia.com/doc/api-reference/widgets/refinement-list/js/#widget-param-sortby
08:35
Jason
08:35 PM
(Assuming you're using Instantsearch lib with Typesense)
Sean
Photo of md5-2d5361393096e40eccbe0d4cfa49f7de
Sean
08:36 PM
Yep, well the react headless version
Jason
Photo of md5-8813087cccc512313602b6d9f9ece19f
Jason
08:38 PM
I see, looks like the they don't have an equivalent configuration in react-instantsearch.

So you might have to sort items as needed using transformItems: https://www.algolia.com/doc/api-reference/widgets/refinement-list/react/#widget-param-transformitems
Sean
Photo of md5-2d5361393096e40eccbe0d4cfa49f7de
Sean
08:43 PM
I should not have overthought this. I got the result with a normal js array sort on items

1