neo4j中cypher语句多个模糊查询

总结一下经验:

neo4j中,cypher语句的模糊查询,好像是个正则表达式结构。

对于一个属性的多个模糊查询,可以使用如下写法:

比如,查询N类型中,属性attr包含‘a1’或者‘a2’的所有节点。

match (n:N)

where n.attr =~ '.*a1.*|.*a2.*'

return n

 

相对于另外一种写法

match (n:N)

where n.attr =~ '.*a1.*' or  n.attr =~ '.*a2.*'

return n

 

使用explain,也可以查看出,第一种写法的优势。

 

posted on 2018-04-25 15:39  bingwork  阅读(9136)  评论(0编辑  收藏  举报

导航