码迷,mamicode.com
首页 > 其他好文 > 详细

neo4j用collect 代替union 并实行分页

时间:2019-01-09 18:40:31      阅读:274      评论:0      收藏:0      [点我收藏+]

标签:neo4j   reply   pre   collect   union   post   guid   csharp   where   

MATCH pa=(j:User)-[r:PostLikeRel|:ReplyRel|:RetweetRel]->(m:User{guid:"f092a1dc6c23b26b020bda24b9e8c923"}) 
where (j.acc is not null and j.acc <> ‘‘ and j<>m)
with collect({acc:j.acc, guid:j.guid, pcnt:coalesce(r.pcnt,0), lcnt:coalesce(r.lcnt,0), type:type(r)} ) as rows1

OPTIONAL MATCH po=(j:User)<-[r:PostLikeRel|:ReplyRel|:RetweetRel]-(m:User{guid:"f092a1dc6c23b26b020bda24b9e8c923"}) 
where (j.acc is not null and j.acc <> ‘‘ and j<>m) 
with rows1+ collect({acc:j.acc, guid:j.guid, pcnt:coalesce(r.pcnt,0), lcnt:coalesce(r.lcnt,0), type:type(r)+"_"}) as allrows

unwind allrows as row
with row.acc as acc, row.guid as guid, row.pcnt+row.lcnt as pcnt, row.type as type
return acc,guid, pcnt,type
order by pcnt desc
skip 0 limit 20

  

neo4j用collect 代替union 并实行分页

标签:neo4j   reply   pre   collect   union   post   guid   csharp   where   

原文地址:https://www.cnblogs.com/learningJAVA/p/10245805.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!