2015-01-01 77 views
0

這裏是我的暗號查詢跳過具有收藏在Cypher支架的Neo4j

MATCH (notification:Notification)-[:CREATED_BY]->(user:User) 
MATCH (notification)-[:NOTIFICATION_COUNTRY]->(country:Country) 
WHERE notification.status='PENDING' AND notification.type='SIMPLE' 
RETURN collect({id:id(notification),message:notification.message,updated:notification.lastUpdatedDate,edited:user.username,country:country.name}) as notifications 
LIMIT 25 

我想跳過,在notification.But LIMIT,我在這裏返回的通知集合,那麼,如何使用與收藏SKIP,有任何其他方式來做到這一點?

回答

4

您可以WITH使用SKIPLIMIT在一起,並創建您的收藏之前,從而限制了通知:

MATCH (notification:Notification)-[:CREATED_BY]->(user:User) 
MATCH (notification)-[:NOTIFICATION_COUNTRY]->(country:Country) 
WHERE notification.status='PENDING' AND notification.type='SIMPLE' 
WITH notification 
SKIP 10 
LIMIT 20 
RETURN collect({id:id(notification),message:notification.message,updated:notification.lastUpdatedDate,edited:user.username,country:country.name}) as notifications 
+0

感謝@克里斯托夫,這是工作的罰款。我想再問一個問題,我們可以優化這個查詢,並獲得更快的響應,然後這個。我對cypher很陌生,想要更多的技巧來獲得更快的響應或正確的寫查詢方式。 –

+0

如果您在notification.type和/或狀態上創建索引 –

相關問題