【问题标题】:Several arguments apoc.index.relationships in Neo4J CypherNeo4J Cypher 中的几个参数 apoc.index.relationships
【发布时间】:2019-01-13 13:09:59
【问题描述】:

我目前有一个请求:

 CALL apoc.index.relationships('TO','context:15229100-b20e-11e3-80d3-6150cb20a1b9') 
 YIELD rel, start, end

有人知道我如何搜索多个context 值,例如:

 CALL apoc.index.relationships('TO','context:15229100-b20e-11e3-80d3-6150cb20a1b9,context:a0328202-d98a-492e-92ae-1010cb829a8ee') 
 YIELD rel, start, end

apoc.index.relationships 有可能吗?

更新

一种可能的方法是使用UNION CALL 类似

 CALL apoc.index.relationships('TO','context:15229100-b20e-11e3-80d3-6150cb20a1b9') 
 YIELD rel, start, end
 UNION CALL apoc.index.relationships('TO','context:15229100-b20e-11e3-80d3-6150cb20a1b9,context:a0328202-d98a-492e-92ae-1010cb829a8ee') 
 YIELD rel, start, end

这会产生良好的效果。但我想知道是否有更优雅的方式来执行此操作,这也会使请求更短?

谢谢!

【问题讨论】:

    标签: neo4j cypher neo4j-apoc


    【解决方案1】:

    可以使用lucene语法:

    context:15229100-b20e-11e3-80d3-6150cb20a1b9 OR context:15229100-b20e-11e3-80d3-6150cb20a1b9

    甚至是一个数组:

    context:(15229100-b20e-11e3-80d3-6150cb20a1b9 15229100-b20e-11e3-80d3-6150cb20a1b9)

    https://lucene.apache.org/core/2_9_4/queryparsersyntax.html

    【讨论】:

    • 这太棒了!尽管加载速度大致相同,但使请求更短。但绝对给了我更多的灵活性。谢谢!
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-05-24
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多