cancel
Showing results for 
Search instead for 
Did you mean: 

Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.

Returning node where a string appears in ANY of its properties

I would like to be able to search for the existence of a certain string in ANY of the properties of a given node.

For example, take: match(mynode) where mynode.names contains "Alfred Pennyworth" return mynode

except I want to do this for ALL of the properties. If mynode has a properties "names" "college" "fingers" "thumbtack_weight_in_tons" etc etc, I want to be able to see if ANY of those properties contain the string "Alfred Pennyworth".

Theoretically, if I knew all the properties of every node, I could search them one at a time, but I'm working with a very irregular data set.

Any help?

1 REPLY 1

Hello @drf57 and welcome to the Neo4j community

MATCH (n)
WHERE any(k IN keys(n) WHERE n[k] =~ "(?i).*"+"Alfred Pennyworth"+".*")
RETURN n

Regards,
Cobra