Skip to content

Instantly share code, notes, and snippets.

@Hkazanci93
Created November 18, 2021 16:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Hkazanci93/6e8780ae60e4ead13d954319b71ceb89 to your computer and use it in GitHub Desktop.
Save Hkazanci93/6e8780ae60e4ead13d954319b71ceb89 to your computer and use it in GitHub Desktop.
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