Use OPTIONAL MATCH to get fans
@@ -9,7 +9,8 @@ WITH $blacklist AS blacklist
MATCH
(country:Country {name: $country})<-[:isPartOf]-(:City)<-[:isLocatedIn]-
(person:Person)<-[:hasCreator]-(reply:Comment)-[:replyOf]-(message:Message),
- (reply)-[:hasTag]->(tag:Tag),
+ (reply)-[:hasTag]->(tag:Tag)
+OPTIONAL MATCH
(fan:Person)-[:likes]->(reply)
WHERE NOT (message)-[:hasTag]->(tag)
AND size([word IN blacklist WHERE reply.content CONTAINS word | word]) = 0
