-
Notifications
You must be signed in to change notification settings - Fork 616
Repository query method with 'contains' on list property generates incorrect cypher query #2444
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
Comments
Hey. This is an interesting one, takes for taking the time to create it, much appreciated In Spring Data commons Things that interest me:
Thanks in advance. |
Hey Michael, thanks for your quick response. See the domain class in my sample project: https://github.com/rlippolis/spring-data-neo4j-listcontains-test/blob/main/src/main/kotlin/com/example/neo4jlistcontainstest/TestNode.kt I'm not using any custom converters. The property currently is a |
…nProperty`. This fixes #2444.
collectionProperty`. This fixes #2444.
…nProperty`. This fixes #2444.
…nProperty`. This fixes #2444.
Thank you, @rlippolis Thanks to the Cypher-DSL based builder, this was an easy fix / improvement. Thanks again for reporting it and providing the reproducer. |
Awesome, thanks for the quick response and fix, @michael-simons! 👍 |
Given a graph with the following node:
If I want to write a repository query method to find the nodes which contain a given item in their
items
list property, I expect the following to work:However, executing this method yields no results, because it generates the following cypher query:
So it uses the
CONTAINS
keyword, which in cypher is used for partial String matching. I would have expected it to create the following query:My first thought was that maybe I should modify my query method to use
In
instead ofContains
, but that only works the other way around (matching a property against a list of possible items), e.g.:fun findByDescriptionIn(descriptions: List<String>): TestNode?
, which correctly generates a cypher query using theIN
keyword.Am I missing something (not so) obvious here, or is this indeed a bug?
See example project with failing test case here: https://github.com/rlippolis/spring-data-neo4j-listcontains-test
The text was updated successfully, but these errors were encountered: