#community-help

Issue with Nested Objects Functionality in Typesense

TLDR Edward encounters unexpected results with nested objects functionality. Kishore Nallan confirms it's a limitation in Typesense and cites a related issue. Oliver shares a similar experience.

Powered by Struct AI

1

Feb 24, 2023 (9 months ago)
Edward
Photo of md5-abd5ee17039f6a27ff7f2bc0e3ef7131
Edward
10:25 AM
We have been working on the nested objects functionality which looked like it was going to work for us but we are getting results back that we didn’t expect.

On each one of our records we have a data structure like so

record1: aud_countries = [{name: 'United Kingdom', value: 10}, {name: 'Italy', value: 90}]
record2: aud_countries = [{name: 'Jamaica', value: 10}, {name: 'London', value: 90}]

The issue we are having is that when performing a search for say ‘London’ and ‘> 85’ we would expect to only get back record2, but we get back record1 as well. It appears to check for the presence of both values in both the whole array and objects within it, rather than just the object itself so it finds a value of 90 in both records.

Hopefully that makes sense.
Is there a way to achieve the desired functionality? or have we written our objects wrong?
Any help is greatly appreciated
Kishore Nallan
Photo of md5-4e872368b2b2668460205b409e95c2ea
Kishore Nallan
10:30 AM
Filtering is applied globally and it's not possible currently to apply it amongst siblings of a nested array.

I think this is along the similar lines of this: https://github.com/typesense/typesense/issues/828

It's on our immediate backlog.

1

Oliver
Photo of md5-d8ab318faff4aecf0aa4f67525bd590d
Oliver
02:03 PM
I was looking exactly for the same thing 😮