Created
November 18, 2021 16:20
-
-
Save Hkazanci93/6e8780ae60e4ead13d954319b71ceb89 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
MATCH (me:Person {userid: $userid}) | |
OPTIONAL MATCH (me)-[:ignores]->(ign:IgnoreSetting) | |
WITH me, ign | |
MATCH (poster:Person)-[:posted]->(post:Post) | |
WHERE (poster = me OR (poster)-[:friended]-(me)) | |
AND (NOT (post)-[:inCategory]->(:Category {name:ign.category}) AND NOT (post)<-[:posted]-(:Person {userid:ign.poster})) | |
WITH post, poster, me | |
OPTIONAL MATCH (post)-[:hasComment]->(comment:Comment)<-[:commented]-(commenter:Person) | |
WHERE commenter = me OR (commenter)-[:friended]-(me) | |
WITH me, post, poster, collect(comment) as comments, collect(commenter) as commenters | |
ORDER BY post.created DESC | |
SKIP $skip | |
LIMIT $limit | |
RETURN post, poster, comments, commenters |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment