如何使字符串包含 Neo4j Cypher 上的过滤器 [英] How can I make a string contain filter on Neo4j Cypher
本文介绍了如何使字符串包含 Neo4j Cypher 上的过滤器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我需要在 Neo4J 中创建一个包含过滤器的字符串.这个想法很简单.
I need to make a string contain filter in Neo4J. The idea is simple.
一个很好的例子是,我需要从一个人的数据库中检索所有在他的名字中包含汽车子字符串的人.
A good example is that I need to retrieve from a database of persons all the people that contain in his name the car substring.
我该怎么做?
推荐答案
您可以使用正则表达式来匹配名称的一部分,例如:
You can use regular expressions to match a part of a name, for example:
MATCH (n)
WHERE n.name =~ '.*car.*'
RETURN n
如果您将标签人"分配给数据库中的所有人,则查询将是:
If you have the label 'Person' assigned to all people in your database, the query would be:
MATCH (n:Person)
WHERE n.name =~ '.*car.*'
RETURN n
有关更多信息,请参阅http://docs.neo4j.org/chunked/stable/query-where.html#_regular_expressions
这篇关于如何使字符串包含 Neo4j Cypher 上的过滤器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文