Hello everyone, Hope you're all doing great! :wave...
# community-help
a
Hello everyone, Hope you're all doing great! šŸ‘‹ I'm currently facing a challenge while using the Typesense adapter with the
group_by
feature and would really appreciate your help or any pointers. šŸ”§ Problem 1: Sorting
group_by
response based on
grouped_hit
count
I'm using the
group_by
parameter on
supplierInfo
to group parts by supplier. The issue is that the response is not sorted based on the number of
grouped_hits
, which is something I need. šŸ“Œ Why this sorting is important: I want to differentiate suppliers based on how many parts they are fulfilling from the requested set. However, Typesense has limits: • Max 250 groups • Max 100
grouped_hits
per group
These limits create a situation where even if the 200th group fulfills all requested parts (100%), it may: • Not appear on top • Or not appear at all in the response āš ļø Sorting on the frontend is heavy and hard to manage, especially when the full context is missing due to the limits.
I believe pushing this logic closer to the source (Typesense) is more efficient.
šŸ”§ Problem 2: Sorting based on fulfillment % (ordered quantity vs available quantity) Along with
grouped_hit
count, I also want to sort suppliers based on how well they fulfill the quantity. šŸ” Example: If 2 suppliers both match 3 parts: • Supplier A provides 100% of the requested quantities • Supplier B provides only 50–70% of the quantities Even though the number of hits (parts matched) is the same, I want Supplier A to appear before Supplier B based on fulfillment %. āœ… Requirements: All suppliers (even partial ones) should still appear. The sort order should prioritize: 1. Higher number of parts matched 2. Then higher % of quantity fulfilled āŒ Current Issue: The current response from Typesense (via adapter) seems to return groups in random order, without a way to control: • Sorting based on
grouped_hit.length
• Or a custom criteria like fulfillment % ā“*My Question:* Is there a native way in Typesense or via the adapter to sort
group_by
results based on: •
grouped_hit.length
(number of hits per group), or • A custom criteria like fulfillment percentage? If not, any ideas or workarounds (adapter-level or Typesense-level) would be really helpful! šŸ™ Thanks in advance!