#community-help

Typesense Filter Ranking and User-Specific Filters

TLDR Pramit inquires about filter ranking in Typesense. Kishore Nallan explains filters are ranked by count, with no secondary sorting option. However, secondary sorting is on their roadmap, and client-side sorting is suggested for now.

Powered by Struct AI
Jun 06, 2023 (4 months ago)
Pramit
Photo of md5-9189cb2309db5c51fa1801b6635ace4d
Pramit
05:55 AM
Does typesense allow filters ranking or user specific filters
Kishore Nallan
Photo of md5-4e872368b2b2668460205b409e95c2ea
Kishore Nallan
07:52 AM
Can you elaborate what you mean by filters ranking?
Pramit
Photo of md5-9189cb2309db5c51fa1801b6635ace4d
Pramit
07:56 AM
Hi kishore,
Suppose, Facet A having filters A1, A2, A3, A4
I want A3 should always come on top
Kishore Nallan
Photo of md5-4e872368b2b2668460205b409e95c2ea
Kishore Nallan
07:57 AM
No we don't have a way to do that. During faceting, values are ranked according to counts.
Pramit
Photo of md5-9189cb2309db5c51fa1801b6635ace4d
Pramit
07:58 AM
okay, so thats the only parameter on which filters are ranked
Kishore Nallan
Photo of md5-4e872368b2b2668460205b409e95c2ea
Kishore Nallan
07:59 AM
Yes
Jun 07, 2023 (4 months ago)
Gurpreet
Photo of md5-a3d626422cb793e221d0996d21463171
Gurpreet
06:31 PM
Hi Kishore Nallan,

If multiple filters have the same count, is there any second argument or way for us with whom we can sort the results?

Our use case is we want to control/manage the order of filters based on the trends/popularity.

If there is no way to achieve this through typesense UI, Can you guide us whether something like this is possible where we can show the ordered facets from our Server and then just filter the results on clicking them through typesense?
Jun 08, 2023 (4 months ago)
Gurpreet
Photo of md5-a3d626422cb793e221d0996d21463171
Gurpreet
06:05 PM
Kishore Nallan Any thoughts from your side?
Jun 09, 2023 (4 months ago)
Kishore Nallan
Photo of md5-4e872368b2b2668460205b409e95c2ea
Kishore Nallan
02:30 AM
We don't have a secondary sorting option for facet fields but this is on our roadmap. You will have to do this client side after getting the results from Typesense API using the client.