Neo4j -- WHERE, ORDER BY, and LIMIT after UNION -
i'm trying query involves union, filters where, order by, , limit after union.
the basic idea find posts starred or posted users user follows. example, posts s
, p
posts of interest.
match (a:user {id:0})-[:follows]->(b:user), (b)-[:starred]->(s:post), (b)-[:posted]->(p:post)
i'd return union of id property of both s
, p
after filtering, sorting, , limiting results. relevant indexes create make query efficient helpful well.
if u
union of s
, p
, i'd want like:
where u.time > 1431546036148 return u.id order u.time skip 0 limit 20
i don't know how u
s
, p
, , don't know indexes create make query efficient.
you can use multiple relationships types you'll not have union.
i guess time property on post
node :
match (user:user {id:0})-[:follows]->(friend:user) match (friend)-[:starred|:posted]->(p:post) p.time > 1431546036148 return p order p.time limit 25
Comments
Post a Comment