3
votes

I am trying to replicate the "auto-complete" functionality of the neo4j browser interface using only a cypher query. A successful implementation would mean that if the query is executed in the browser, toggling the auto-complete button would have no effect, as all "additional relationships" are specified in the query.

I use the browser to prototype the queries, then use RNeo4j to implement them. Ideally, I'd like the RNeo4j result to match the browser result including auto-complete.

As an example, consider the query:

`MATCH p = (n:label1 {name:'tom'})-[r*2..3]-(n:label1 {name:'jerry'})
RETURN p`

In the browser, with auto-complete turned off, I only get what I asked for (as expected), whereas when auto-complete is turned on, I get all relationships between any nodes on the path where neither node is "tom" or "jerry".

I have tried using WITH followed by a second MATCH following the first MATCH but this does not yield the results I require.

Any help greatly appreciated!

1

1 Answers

7
votes

the autocomplete feature makes another call to get the relationships between all the node ids it currently has

match a-[r]-b where id(a) in [1,2...] and id(b) in [1,2,3...] return r