#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 (6 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 (6 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 (6 months ago)
Gurpreet
Photo of md5-a3d626422cb793e221d0996d21463171
Gurpreet
06:05 PM
Kishore Nallan Any thoughts from your side?
Jun 09, 2023 (6 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.

Typesense

Lightning-fast, open source search engine for everyone | Knowledge Base powered by Struct.AI

Indexed 3005 threads (79% resolved)

Join Our Community

Similar Threads

Resolve Facets and Sorting Issues with Typesense

Ethan needed assistance with getting all facet values and sorting results by date using Typesense. Jason provided guidance on how to use Typesense properties to accomplish these tasks, and resolved issues related to specific use-cases provided by Ethan and Rushil.

11

70
4mo
Solved

Typesense Facet Sorting When Counts Are Equal

Pedro inquired about sorting facets when counts are the same. Kishore Nallan explained it uses internal ID and directed to an existing GitHub issue discussing alphabetical ordering.

10
6mo
Solved

Query on Facet Values, `max_facet_values` , and `facet_query_num_typos`.

Jan asked about sorting facet values, managing `max_facet_values` and issues with `facet_query_num_typos`. Jason clarified the details on instantsearch widget handling of `max_facet_values` and identified a bug on the Typesense Server. Jason suggested a solution to the sorting issue.

2

23
1mo
Solved

Facet Groups Filtering with Typesense and Instantsearch.js

Cristopher was having issues with faceting on Typesense and sought advice. Kishore Nallan and Jason provided recommendations and resources. Cristopher finally resolved the issue by switching to instantsearch.js.

1

9
18mo
Solved

Typesense Facet Query Issue and Resolution

Stefan wanted to have typesense return count: 0 for filtered out facets, which was not supported. They shared a workaround using a server data call. The solution involved adding "facets: [this.filterConfig.attribute]," for the server adapter to work. Kishore Nallan acknowledged the resolution.

8
29mo
Solved