user697911
user697911

Reputation: 10531

How to use OR in this WHERE clause?

MATCH (s:Product {id:'002'})-[r]-> (o:Attributes)
WHERE any(key in keys(o) 
    WHERE key CONTAINS value) 
return s, r, o

In the 2nd clause, I want to express either "key CONTAINS value" OR "value CONTAINS key". How to add the second possibility in this WHERE clause?

Upvotes: 0

Views: 41

Answers (1)

InverseFalcon
InverseFalcon

Reputation: 30397

Assuming the value variable is in scope from some unseen earlier section in the query, it should be as easy as adding the OR and the predicate:

...
MATCH (s:Product {id:'002'})-[r]-> (o:Attributes)
WHERE any(key in keys(o) 
    WHERE key CONTAINS value OR value CONTAINS key) 
RETURN s, r, o

Upvotes: 1

Related Questions