天天看點

neo4j中cypher語句多個模糊查詢

總結一下經驗:

neo4j中,cypher語句的模糊查詢,好像是個正規表達式結構。

對于一個屬性的多個模糊查詢,可以使用如下寫法:

比如,查詢N類型中,屬性attr包含‘a1’或者‘a2’的所有節點。

match (n:N)

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

return n

相對于另外一種寫法

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

使用explain,也可以檢視出,第一種寫法的優勢。

原文位址:https://www.cnblogs.com/bingwork/p/8945161.html

上一篇: Neo4j-Apoc
下一篇: Neo4j 文檔