Remove data in nested array that does not match filter #879
Fronix
started this conversation in
Feedback & Feature Proposal
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I understand this might be a big ask but I want to bring it up anyway.
Currently meilisearch indexes have documents that come "as is" unless you specify
attributesToRetrieve. When filtering on data through a accesstoken the data wont be filtered if it's inside an array, it will match data but if the array inside the document has 5 objects and it matched one of them, all the objects are returned.Right now, we are expected to remove this ourselves, which is possible for sure but it does add overhead.
What I'm looking for is the ability to tell meilisearch that it should actually remove the objects in the array that doesn't match from the search result.
Example:
Say I filter on
theObjects.type = 'triangle'the documents in the result will be both123and124with alltheObjectsinside it{ { "id": "123", "name": "test", "theObjects": [ { "name": "My square", "type": "square" }, { "name": "My triangle", "type": "triangle" }] }, { "id": "124", "name": "test2", "theObjects": [ { "name": "My rectangle", "type": "rectangle" }, { "name": "My triangle", "type": "triangle" }] }, }What I would want is this
filter:
theObjects.type = 'triangle'{ { "id": "123", "name": "test", "theObjects": [ { "name": "My triangle", "type": "triangle" } ] }, { "id": "124", "name": "test2", "theObjects": [ { "name": "My triangle", "type": "triangle" } ] }, }This should probably be a opt-in feature that is enabled during searchtime, so that the default behaviour can be used when needed.
It would enable easier index structuring and not having to build custom backend solutions that uses filter logic to find nested data and remove it before returning the result. It also acts as a security feature since you might have access to documents but not some data inside the documents.
Beta Was this translation helpful? Give feedback.
All reactions