Prioritising Email in Collections Using Typesense
TLDR Pankaj had an issue ranking user emails first in a collection. Jason explained how 'sort_by' works and suggested using the new filter-based sorting mechanism, specifically
"sort_by": "_eval(has_email:true):asc,id:desc". Pankaj agreed to try this solution.
Oct 26, 2022 (11 months ago)
my example collection
email id description
i want to rank the result where users with having email are ranked first with id desc
tried doing sort_by
but looks like missing_values is last one to sort so it always like email desc any other ways this can be done ? thanks in advance
You could use the new filter-based sorting mechanism we’ve added in 0.24.0.rcn25 to implement your use case. Something like:
has_emailis a new boolean field you’ll have to create at indexing time to each record
Oct 27, 2022 (11 months ago)
Indexed 2764 threads (79% resolved)
Methods for Fetching, Querying, and Modifying Collections in Typesense
Bill inquired about performing OR queries, querying empty arrays and modifying collections in Typesense. Kishore Nallan explained the current limitations and provided workarounds and recommendations for each case. The conversation also touched upon the usage of cache in Typesense and the workings of the _eval function.
Document Weighting and Sorting Discussion
SamHendley asked how to weight a document based on age and offered a sorting method. Jason clarified the method and suggested an RC for use. SamHendley tested and confirmed the solution. User Kishore Nallan assisted when an error occurred with a new feature.
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.