#community-help

Grouping by Individual Items in Array of Ints in Typesense

TLDR TJ asks about grouping by individual items in an array of ints in Typesense. Kishore Nallan confirms it's not possible, but it's in their plans to address the issue.

Powered by Struct AI
Mar 23, 2023 (9 months ago)
TJ
Photo of md5-3afef4cc9e9291f4f991a88147c78384
TJ
11:59 PM
If I have a field that is array of ints and I want to group by that field, is it possible for typesense to group by each individual item in the array?

For example: if the field is called sample and document A has sample: [1] while document B has sample: [1, 2]. It looks like if I group by sample, typesense will return two groups with keys: [1] and [1,2].

But what if I wanted it to have keys: [1] and [2], is there a way I can achieve this?
Mar 24, 2023 (9 months ago)
TJ
Photo of md5-3afef4cc9e9291f4f991a88147c78384
TJ
12:02 AM
If not, are there any recommendations on how to work around this?
09:10
TJ
09:10 AM
Any ideas here, please?
Kishore Nallan
Photo of md5-4e872368b2b2668460205b409e95c2ea
Kishore Nallan
09:16 AM
This is currently not possible because we treat the group as a whole value. However we are planning to address this because it is different from how facets behave (where each individual value is treated separately).
TJ
Photo of md5-3afef4cc9e9291f4f991a88147c78384
TJ
09:18 AM
Hmm, thanks Kishore. That's good to know