user201411
user201411

Reputation: 254

neo4j NOT IN query

I have a very simple query

MATCH p=(a:User)-[r:VISITS]->(end:Page)
WHERE r.rating<2 AND t.rating>5
RETURN EXTRACT (n IN nodes(p)|n.page_id) ,count(p)
ORDER BY count(p) DESC;

This works fine. However, each end node is assigned a property page_id. I have an external python script that generates a list of page_id that are whitelisted and should be ignored. For example page_id_white=[1,4,5,6] should be ignored and the code should return only paths where end.page_id is not in page_id_white. I have tried a simple NOT IN page_id_white statement, but it didn't work. Can someone help me out on how to proceed?

Upvotes: 1

Views: 3474

Answers (1)

Nicole White
Nicole White

Reputation: 7790

Can't do NOT IN. Needs to be WHERE NOT thing IN coll.

MATCH p=(a:User)-[r:VISITS]->(end:Page)
WHERE NOT end.page_id IN {page_id_white}
RETURN EXTRACT(n IN NODES(p) | n.page_id), COUNT(p)
ORDER BY COUNT(p) DESC;

Upvotes: 4

Related Questions