Hi everyone,
it's my first post in this community and I hope to do everything correctly, if not, be patient!
I'm trying to structure a small social network, but I can't develop a query that will surely be very simple for you.
The query I have to develop is the one useful for picking up posts on the wall.
I should therefore take both the posts of the users followed by the user who views the wall, and directly the posts created by the user who views the wall.
I show you a cypher query that I have developed:
MATCH (cu:User)-[:FOLLOWS]->(u:User)-[:POSTS]->(p:Post)
WHERE id(cu) = 12345 //cu stands for Current User
RETURN p
In this query cu
is the user viewing the wall, u
are the users followed by cu
and p
are the posts I would like to return.
Looking at the objectives described above, it is evident that this query cannot also return the posts created by cu
. So what's the best way, in your opinion, to return both posts in a single query?
I tried also to use the EXISTS
function but with very poor performance results.