It appears that LIKE is not supported in Cypher queries.
Is there any other construct that would perform the same task?
For instance:
start n = node(*) where n.Name LIKE('%SUBSTRING%') return n.Name, n;
It appears that LIKE is not supported in Cypher queries.
Is there any other construct that would perform the same task?
For instance:
start n = node(*) where n.Name LIKE('%SUBSTRING%') return n.Name, n;
using regular expressions: http://neo4j.com/docs/developer-manual/current/#query-where-regex
start n = node(*) where n.Name =~ '.*SUBSTRING.*' return n.Name, n;
start n=node:your_index('property:*SUBSTRING*') return n.name, n;
start n = node(*) where n.Name =~ {like} return n.Name, n;
params: {"like":".*SUBSTRING.*"}, also node(*) as start clause hints at a non-graph use-case, then rather use ulkas' index lookup suggestion
Dec 19, 2012 at 18:25
As of version 2.0, the preferred syntax uses MATCH
.
e.g.
MATCH (n) where n.Name =~ '.*SUBSTRING.*' return n.Name, n;
No Regexps needed:
start n = node(*) where n.Name contains "substring" return n.Name, n;
Go to the cypher refcard and scroll down to the Predicates section. You will find this and other useful stuff.
Want case-insensitive? Convert to lower case:
start n = node(*) where lower(n.Name) contains lower("substring") return n.Name, n;
=~ '(?i)substring'
but it doesn't perform well. the lower() prevents index usage so on big data it will just hang. I have an open feature request here: github.com/neo4j/neo4j/issues/9450
If you want to make it case insensitive
MATCH (n) WHERE n.name =~ '(?i).*SUBSTRING.*' RETURN n;