Search code examples
javaneo4jspring-data-neo4j-4neo4j-ogm

Depth configuration in fetch queries not using relationships directions in Neo4j OGM APIs


I'm using neo4j's findAll() APIs (OGM 2.0.5) to fetch nodes using filters, paging, sorting and custom depth. Everything is working perfectly, except that generated cypher queries don't take relationships direction into account:

MATCH (n)...
WHERE...
WITH n
MATCH p=(n)-[*0..d]-()
RETURN p

instead of: ...MATCH p=(n)-[*0..d]->()...

Is it really important for me, because not taking relationships directions into account causes huge amount of nodes to be returned by the query. For now my only option is to write manually all my queries in CYPHER.

Some times my queries freeze or are extremely slow. But they are very fast if I specify the direction manually.

It is possible/planned to let configure this behavior in order to have optimized queries based on graph modelisation ?


Solution

  • We have a feature request open for this one, you can track it here https://github.com/neo4j/neo4j-ogm/issues/70