Sorting and Grouping Order Collections by ItemId and Price
TLDR Xing had trouble sorting and grouping order collections by item Id and lowest price. Ivan suggested using facet_by, while Kishore Nallan clarified that only desc order on highest price is possible and suggested a feature request.
Dec 22, 2022 (12 months ago)
Order {
itemId,
price
}
Ivan
06:53 AMhttps://typesense.org/docs/0.23.1/api/search.html#faceting-parameters
Kishore Nallan
10:48 AMIt's only possible to order desc on the highest price of each group, which is done this way:
"group_by": "itemId",
"sort_by": "price:desc"
Once the records are grouped by itemId, the highest priced record in each group will be then used to order the groups.
Can you please create a feature request for this her: https://github.com/typesense/typesense/issues
Typesense
Indexed 3005 threads (79% resolved)
Similar Threads
Sorting and Grouping Products According to Price
Valdrin asked how to sort and group products and always display the lowest price. Kishore Nallan clarified internal and global sorting, suggesting client side sorting as a workaround.
Grouping and Ordering Results in Database Queries
Maximilian asked about grouping and ordering results by number of hits per group. Kishore Nallan clarified that faceting could be used, but could not order by counts.
Sorting Issues with Typesense's `group_by` Param
Vamshi was puzzled by inconsistent results order in Typesense. Kishore Nallan clarified how `group_by` sorting works, assisting Vamshi in resolving the problem.