Skip to content
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

Replace ALL with ANY in whilst querying relationship equality #196

Merged
merged 1 commit into from
May 10, 2021

Conversation

darrellwarde
Copy link
Contributor

@darrellwarde darrellwarde commented May 7, 2021

Description

Fixes Cypher generation when checking for equality of fields on related nodes, replacing ALL with ANY to return expected results. See linked issue for example.

ALL still used for _IN and _NOT_IN filters, which I believe is the correct behaviour.

Issue

#190

Checklist

The following requirements should have been met (depending on the changes in the branch):

…ds, validated by user expectations from issue
@johnymontana
Copy link

I think the ANY is the right approach here. Using the movie example from the tests - when filtering for movies that are in the "Action" genre, you will have movies connected to multiple genre nodes and you only want to apply a predicate that says the movie has at least one relationship to the "Action" genre node, not that all genre relationships are to the "Action" genre node.

An alternative would be to create additional where filtering inputs such as genres_some, genres_every, genres_single, etc that map to the various Cypher list predicate functions. I don't think exposing each of these list predicates is the approach to take here though as I think the vast majority of use cases users are wanting the ANY logic applied and the additional list predicate options add confusion and leak Cypher specific concepts to the GraphQL layer.

Copy link
Member

@oskarhane oskarhane left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking at the integration tests, this seems like the right thing to do.
I think Wills point on creating more fine grained filters if requested sounds sensible, while keeping this as a default.

🌻

@darrellwarde darrellwarde merged commit 935f954 into neo4j:master May 10, 2021
@darrellwarde darrellwarde deleted the bugfix/#190-cypher-all-any branch August 10, 2021 10:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Why ALL is used instead of ANY when converting where query filters to cypher?
3 participants