Cypher LinkedList Match by index but “Don't know how to compare that.” instead

后端 未结 1 1011
無奈伤痛
無奈伤痛 2021-01-26 10:52

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

相关标签:
1条回答
  • 2021-01-26 11:28

    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.

    0 讨论(0)
提交回复
热议问题