Most recent replies

Return the 20 most recent reply comments to all the posts of a person from friends or friends-of-friends created before a date.

T-Cypher:

LEFT_SLICE 2014-01-01T08:00:00Z ON R

MATCH (pe1:Person)<-[hasCreator]-(po:Post)<-[replyOf]-(c:comment)<-[hasCreator]-(pe2:Person), (pe1)-[CONTINUOUS(k:knows*1..2)]->(pe2)

RETURN c ORDER BY START(c@T) LIMIT 20

Cypher:

MATCH (pe1:`Person`)<-[hasCreator]-(po:`Post`)<-[replyOf]-(c:`comment`)<-[hasCreator]-(pe2:`Person`), (pe1)-[k:`knows`]->(pe2) WHERE (hasCreator.tStart <= 1388563200000 AND replyOf.tStart <= 1388563200000 AND hasCreator.tStart <= 1388563200000 AND k.tStart <= 1388563200000) RETURN c LIMIT 20 UNION MATCH (pe1:`Person`)<-[hasCreator]-(po:`Post`)<-[replyOf]-(c:`comment`)<-[hasCreator]-(pe2:`Person`), (pe1)-[r0:`knows`]->(n0)-[r1:`knows`]->(pe2) WHERE (hasCreator.tStart <= 1388563200000 AND replyOf.tStart <= 1388563200000 AND hasCreator.tStart <= 1388563200000 AND r0.tStart <= 1388563200000 AND r1.tStart <= 1388563200000 AND (myFunctions.min([r0.tEnd, r1.tEnd]) – myFunctions.max([r0.tStart, r1.tStart])) > 0) RETURN c ORDER BY myFunctions.start([c.tStart, c.tEnd]) LIMIT 20

Comments are closed.