neo4j用collect 代替union 并实行分页
Posted learningjava
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了neo4j用collect 代替union 并实行分页相关的知识,希望对你有一定的参考价值。
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 并实行分页的主要内容,如果未能解决你的问题,请参考以下文章
使用apache的CollectionUtils取交集,并集和差集