Reputation: 39
In my database I have products that are tagged. Each Product has an array property called index that contains all the words in the tags. Before the last update of Neo4j I could query with the following query which no longer works, I guess it might be deprecated.
MATCH (p:Product)-[:has_tag]->(tag:Tag)
WHERE ALL (x IN ['game', 'action']
WHERE x IN p.index) RETURN p;
I get the error
Type mismatch: p already defined with
conflicting type Node (expected Collection<Any>)
How can I make this query work so that I can, in this case, find all products tagges with both 'game' and 'action'?
Also how is the performance of such queries, is this a good way to go about this kind of search, or could it get slow?
Upvotes: 0
Views: 183
Reputation: 2592
Not sure why it doesn't work with the current version, but you can do this,
MATCH (p:Product)-[:has_tag]->(tag:Tag)
WHERE length(filter(x IN p.index WHERE x in ['game', 'action'])) = 2
RETURN p
Assume there are no duplicated tags in the index
Upvotes: 1