#community-help

Identifying Names for Faceted Object Arrays

TLDR TJ inquires about identifying names in facet results for object arrays. Kishore Nallan explains it's not possible, while John points to a relevant GitHub issue.

Powered by Struct AI
+12
Jun 14, 2023 (3 months ago)
TJ
Photo of md5-3afef4cc9e9291f4f991a88147c78384
TJ
07:39 AM
Hey, say I have an array field of objects like: exampleField: [{name: x, value: y}, {name: z, value: a}...], and I facet by exampleField.value, is there an easy way to identify what exampleField.name each value in the facet result belongs to?
Kishore Nallan
Photo of md5-4e872368b2b2668460205b409e95c2ea
Kishore Nallan
07:45 AM
👋 That's not possible unfortunately. An array of objects are just squashed into field-wise arrays, and the original mapping information is not kept.

In this case, it just becomes:

"exampleField.name": ["x", "z"]
+11
John
Photo of md5-21545f1facb7836c149bc4c70752bd2b
John
11:29 AM
This is what we wanted to do as well, made this issue as one potential solution https://github.com/typesense/typesense/issues/943

Feel free to upvote 🙏
+11