neo4j-graphql-java
neo4j-graphql-java copied to clipboard
Filter on nodes that are nested inside type relation is not working as expected
Filters on the node, which is defined under type relation in schema, are not working as expected. The cypher query that is generated is not correct.
Test Case
GraphQL schema
type Role @relation(name:"ACTED_IN", from:"actor", to:"movie") {
actor: Person
movie: Movie
type: String
}
type Person {
name: String
born: Int
roles: [Role]
}
type Movie {
title: String
released: Int
characters: [Role]
}
type Query {
person: [Person]
movie: [Movie]
}
GraphQL request
{
person(first: 30, roles: { movie_not: null, movie: { title_starts_with: "P" } }) {
roles {
movie {
title
}
type
}
name
}
}
Expected cypher query
MATCH (person:Person) WHERE ( EXISTS {MATCH (person)-[:ACTED_IN]->(:Movie)} AND all(personMovieCond IN [(person)-[:ACTED_IN]->(personMovie:Movie) | personMovie.title STARTS WITH $personMovieTitleStartsWith] WHERE personMovieCond)) RETURN person { roles: [(person)-[personRoles:ACTED_IN]->(personRolesMovie:Movie) | personRoles { movie: personRolesMovie { .title}, .type }], .name} AS person SKIP 0 LIMIT 30
Generated cypher query
MATCH (person:Person) WHERE all(personPersonRolesCond IN [(person)<-[:ACTED_IN]-(personPersonRoles:ACTED_IN) | (EXISTS { MATCH (personPersonRoles)-[:ACTED_IN]->(:Movie) } AND any(personPersonRolesMovieCond IN [(personPersonRoles)-[:ACTED_IN]->(personPersonRolesMovie:Movie) | personPersonRolesMovie.title STARTS WITH $personPersonRolesMovieTitleStartsWith] WHERE personPersonRolesMovieCond))] WHERE personPersonRolesCond) RETURN person { roles: [(person)-[personRoles:ACTED_IN]->(personRolesMovie:Movie) | personRoles { movie: personRolesMovie { .title }, .type }], .name} AS person SKIP 0 LIMIT 30
I am currently working on a major refactoring regarding the API alignment with the JS version. This bug will also be fixed with the new API. There will be no fix for this issue for the current version.
Any Update on this ?
Any Update on this ?
work is still in progress
Any Update on this ?
work is still in progress
Hi @Andy2003, I have raised a PR(https://github.com/neo4j-graphql/neo4j-graphql-java/pull/272) for this bug fix. If you find the implementation proper it can be merged for now till you release the new version with API-Alignment. Also, if you need any help on the api alignment work I am ready to contribute.