neo4j - How to query multiple property values out of order in Cypher -


i have list of product names [shirt,shoes,pants,hat,glasses] i'm trying perform query return products using regular expression that's case insensitive , in order long value exists.

i'm able query them in order match (product:product) product.name =~"(?i).*shirt.shoes." return product

how can query them out of order ie match (product:product) product.name=~"(?i).*hat.shirt."?

thanks

what want search regular expression? looking product names contain 1 of keywords in list? or multiple keywords?

if want find product names contain @ least 1 of keywords in list use string comparison operator contains along tolower() function make comparison case insensitive:

with {products} products match (p:product) any(x in products tolower(p.name) contains tolower(x)) return p 

where {products} array of product names: ['shirt', 'shoes', 'pants', 'hats', 'glasses']

edit

to find product nodes contain keywords, use all() list predicate.

for example, let's want find product nodes name contains "shirt" , "shoes":

with ["shirt", "shoes"] keywords match (p:product) all(x in keywords tolower(p.name) contains tolower(x)) return p 

Comments