Neo4j-发生无效的查询错误 [英] Neo4j - Invalid Query error occured

查看:145
本文介绍了Neo4j-发生无效的查询错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试了以下密码查询.

I have tried following query in 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

那么,此查询出了什么问题?

so, What is wrong with this query?

推荐答案

您需要执行另一个START子句才能做到这一点:

You need to do another START clause to do this:

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链接在一起,所以您将得到other的笛卡尔积和结果中的me/x.

That should be syntactically correct. I'm not exactly sure what your query is trying to do--it doesn't feel right, because the two queries are not linked together with a match, so you're going to get the cartesian product of other and me/x in the results.

这篇关于Neo4j-发生无效的查询错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆