Strict equality checks for simple arrays #719
Replies: 1 comment 1 reply
-
Hi @Fronix , thank you for taking the time to leave your feedback and explain your use case. This is indeed a limitation of how the engine filters currently work; I'm glad you found a workaround that works for you for the time being. To share some extra context, we're currently concentrating our efforts on enhancing the quality of our service. This means we don't have the bandwidth to implement all the feature requests we get immediately. However, your feedback has been noted and will be considered as we continue to improve and evolve. I'll leave the discussion open for other users to upvote if they have the same need. Once again, thank you for your feedback! |
Beta Was this translation helpful? Give feedback.
-
I have an issue where i have an array that i want to filter but the
IN
and=
operators don't work as strict equality checks for simple arrays but rather as includes. Egfilter: "attribute IN [this, that]"
filter: "attribute=this OR attribute=that"
filter: "(attribute=this OR attribute=that) OR (attribute=this AND attribute=that)"
Will all include documents that may have a document with these values
attribute: ["this", "that", "other"]
Example:
In this example i want to find all the documents that have
E01 Psykiatri
orE02 Barn- och ungdomspsykiatri
or both but not anything else.This filter:
"filter": "specializations IN [\"E01 Psykiatri\", \"E02 Barn- och ungdomspsykiatri\"]"
will return all documents includingid: 4
.This is fine but sometimes you want to be exact and what I feel is missing is a strict version of
IN
and=
operator for simple arrays.Something like this:
"filter": "specializations ONLY IN [\"E01 Psykiatri\", \"E02 Barn- och ungdomspsykiatri\"]"
which will return documents that only has both values or one of them eg documents1
2
and3
Data:
Current workaround
My current workaround for this is to filter the results and remove anything that doesn't exactly have what was filtered for, this works fine but when using packages like
instant-meilisearch
it adds a lot of overhead and I feel like this should be a standard feature.Important note:
It's impossible to ensure that you get all the results if the filtered results are more than the maxpage results.
So if my filter returns 200 results and i show 100 results per page, there might be "workaround results" on page 2 that get missed. There is no way to find those without brute force, which negates the whole point of filtering.
This discussion might be slightly related: https://github.com/orgs/meilisearch/discussions/675
Beta Was this translation helpful? Give feedback.
All reactions