Hi again. Having a lot of fun with Typesense. I a...
# community-help
m
Hi again. Having a lot of fun with Typesense. I am playing with group_by and group_limit. I can see the structure for a grouped document is slightly different but was then wondering, if there’s a way to include all of the individual documents that is contained in a group. I know that might sound counter intuitive but would be useful in a case, where you want to show information from the grouped documents. The specific case is this product cards on an ecommerce site. Here’s a screenshot that maybe explains it better:
j
Setting
group_limit
to a large number (even as high as say 10,000) assuming that's the max number of variations you can have in a product, should work...
m
Thank you Jason. I think I get the point, however, I am uncertain whether this can work with Instantsearch.js (React Instantsearch Hooks), as it seems to treat grouped document separately. See pictures, for how it currently looks and the response result. Instantsearch.js seems to have a
distinct
configure option but can that work with the typesense adapter — not sure if it’s at all relevant? I’ve attempted to transform the hits but the hit results does not contain data about the group. How would I go about combining them into a single ‘hit’ for Instantsearch? Thank you 🙂
j
I’ve attempted to transform the hits but the hit results does not contain data about the group.
I was going to suggest this... but the adapter doesn't add this group information currently. Let me add this and give you a version to test
Just published v2.4.2-0 of typesense-instantsearch-adapter, which will now add a group_key field to each hit. So you should be able to use that to group using transformHits
Could you give it a shot and let me know how it goes?
m
I’ll give it shot and report back 🙂
Working great Jason 👍 Thank you. I might have run into other troubles that I hadn’t thought about. But I’ll report back when I have more information 🙂 Anyhow, I might have to index variant information on every document. My current issue is, that I want to show shoe size availability and color variant on a single hit/model (product card). But with grouping I am not certain to get every document belonging to that group obviously. Eg. if I query “nike free blue”, I will only get the documents for the blue variant and not the red variant, even though I want to show that as well. I haven’t explored the issue thoroughly yet. But if you have any ideas they’re more than welcome 😉
j
Storing all variants information for a product on each variant document (as unindexed fields) might be the way to go