New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
_ncontains doesn't work on o2m nested dataset #5996
Comments
@martijnboland Sounds like we've found the limit of the subquery! Negation doesn't work how you would expect it. Take the following minimal example:
Fetch all authors that have an article where title IS NOT "Test" The following SQL is used SELECT
"authors"."id",
"authors"."name"
FROM
"authors"
WHERE
"authors"."id" in(
SELECT
"articles"."author" AS "author"
FROM
"articles"
WHERE
NOT "articles"."title" = 'Test'
)
ORDER BY
"authors"."id" ASC However, this still fetches the top level author as soon as they have any other article that matches the search query 🤔 |
@rijkvanzanten ah crap, well maybe there is a possibility to generate a 'where exists' subquery instead of the 'where in'? Or wouldn't that make a difference? Still early morning here... |
@martijnboland Sounds like a potential solution! Wondering how that affects the negation though 🤔 I believe you can do a "where not exists", but then we might have the opposite problem (where regular filters stop functioning) |
Any news on this? |
Has this been forgotten? There are probably more important bugs, but just asking :) |
Certainly hasn't been forgotten. Unfortunately nobody else seemed to have ran into this issue, fixing it takes quite a lot of rethinking on how nested queries are constructed, and there are other more important bugs that took priority.. We recognize that this may be an important feature/fix, but we are a small open-source organization with a lot to triage and complete. As of now, the only way to get an accurate timeline or release date is to sponsor this task. |
I don´t know what happend, I viewed this issue and it got automatically closed. Sorry. |
Hello, Instead of |
Just to note that this also affects insights. For example, to find all items in a collection where an M2M field is empty is simply not possible. I also can't think of reasonable workarounds...
Both of which are pretty ugly solutions. Any other suggestions welcome |
I believe the Directus-team finds a solution.. no worries 😃. I think this feature would be really useful. |
* feat: refactor apply-query & implements icontains * feat: implements icontains in app * New translations en-US.yaml * tests: fix returns the filter operators for binary * implement rest insensitive operators * fix: proposal to fix #5996 (convert "in" into "exists") * delete unused imports * fix: prevent error when operator filter value is null * fix: apply-query imports * some tests * fix: _nstarts_with not applied correctly * tests: add some filter mathematical tests
Linear: ENG-296 |
Filter not working properly on nested items (on many to one or one to many)
Left column: ID
id: 110
Right column: Jakso (info from another collection)
id: 110 --> 1/2021, 2/2021, 3/2021
Trying to only show the ID:s which does not have 2/2021 anywhere in "Jakso" (screenshot).
In the screenshot ID:110 has got 2/2021, but is still shown.
The text was updated successfully, but these errors were encountered: