0
這個工作查詢開始:如何使用計數過濾WHERE?
MATCH (post:Post)<-[:AUTHOR]-(author:User)
WHERE post.createdAt > { hotAfter } AND post.text =~ { keyword }
MATCH (post)-[:HAS_COMMENT]->(comment:Comment)<-[:AUTHOR]-(commentAuthor:User)
WITH post, author, count(DISTINCT commentAuthor) as participantsCount, count(comment) as commentsCount
ORDER BY (participantsCount * commentsCount) DESC
RETURN collect(post {.*, author, participantsCount, commentsCount})[0..{ LIMIT }] as posts
我還喜歡濾波器的評論數量符合條件的職位:
WHERE (count(DISTINCT commentAuthor) * count(comment)) <= { someNumber }
但我不知道在哪裏/如何申請這個邏輯例如這是不正確的:
MATCH (post:Post)<-[:AUTHOR]-(author:User)
WHERE post.createdAt > { hotAfter } AND post.text =~ { keyword }
MATCH (post)-[:HAS_COMMENT]->(comment:Comment)<-[:AUTHOR]-(commentAuthor:User)
WHERE count(DISTINCT commentAuthor) * count(comment) <= 10
WITH post, author, count(DISTINCT commentAuthor) as participantsCount, count(comment) as commentsCount
ORDER BY (participantsCount * commentsCount) DESC
RETURN collect(post {.*, author, participantsCount, commentsCount})[0..{ LIMIT }] as posts
嗨,其實只是嘗試了這一點,並查詢似乎無效。 – kayla
你能提供關於錯誤的更多細節嗎? – InverseFalcon
'無效的輸入'D'(第6行,第5列(偏移量:308)) 「ORDER BY participantsCount * commentsCount DESC」 ^' – kayla