我在cypher中尝试了以下查询。
START other=node(*)
WHERE other.FirstName =~ "(?i)dh.*" AND other.UserID <> 1
WITH other, me=node:node_auto_index(UserID = '1')
MATCH me-[myR:friends]-(x)
RETURN other.UserID, other.UserName, other.FirstName, other.LastName, other.ImagePath
// myR.ApprovalStatus, COUNT(distinct pMutualFriends) AS mutualFriends
//ORDER BY mutualFriends DESC
LIMIT 100;
但它给了我错误。
These columns can't be listen in the WITH statement without renaming: me=node
所以,这个查询出了什么问题?
答案 0 :(得分:2)
您需要执行另一个START子句来执行此操作:
START other=node(*)
WHERE other.FirstName =~ "(?i)dh.*" AND other.UserID <> 1
WITH other
START me=node:node_auto_index(UserID = '1')
MATCH me-[myR:friends]-(x)
RETURN other.UserID, other.UserName, other.FirstName, other.LastName, other.ImagePath
// myR.ApprovalStatus, COUNT(distinct pMutualFriends) AS mutualFriends
//ORDER BY mutualFriends DESC
LIMIT 100;
这应该在语法上是正确的。我不确定您的查询尝试做什么 - 感觉不对,因为这两个查询没有与match
链接在一起,因此您将获得{的笛卡尔积<1}}和other
/ me
在结果中。