I am having trouble with MATCH by index and I am hoping you can help. Related discussion can be found at this post: Cypher Linked LIst: how to unshift and replace by index
Cypher seems to be confused by the (as far as I can tell) legal [:Foo*1]
syntax. If you just used [:Foo]
instead, which logically equivalent, you would have avoided the error.
But, actually, the way to get the index 0 child is:
MATCH (p { id:"123A" })
MATCH (p)-[r:Foo]->(c)
RETURN c;
Or, to get the 0 index child in a more generic way, this will work. This generic pattern should always work for any index (by replacing 0
with the desired index), but there seems to be a bug (as stated above) in Cypher when using 1
:
MATCH (p { id:"123A" })
MATCH (p)-[:Foo*0]->()-[r:Foo]->(c)
RETURN c
I have created neo4j issue 5799 for this.