Running a case-insensitive cypher query

人盡茶涼 提交于 2019-11-28 21:06:05
Volker Pacher

Yes, by using case insensitive regular expressions:

WHERE m.name =~ '(?i)neo'

http://neo4j.com/docs/developer-manual/current/cypher/clauses/where/#where-case-insensitive-regular-expressions

Another way would be:

WHERE LOWER(m.Name) = LOWER("Neo")

And if you are using the Neo4j Client (.NET):

Client.Cypher.Match("(m:Entity)")
    .Where("LOWER(m.Name) = LOWER({name})")
    .WithParam("name", inputName)
    .Return(m => m.As<Entity>())
    .Results
    .FirstOrDefault();
Mursy Alguineedy

If anybody is looking on how to do this with a parameter, I managed to do it like this.

query = "{}{}{}".format('Match (n) WHERE n.pageName =~ "'"(?i)", name, '" RETURN n')

and "name" is the variable or your parameter

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!