Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/neo4j/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Neo4j 为什么通过restapi返回resultDataContents=graph的集合时会丢失排序顺序_Neo4j_Cypher - Fatal编程技术网

Neo4j 为什么通过restapi返回resultDataContents=graph的集合时会丢失排序顺序

Neo4j 为什么通过restapi返回resultDataContents=graph的集合时会丢失排序顺序,neo4j,cypher,Neo4j,Cypher,有关以下数据: create (a:Attendee {name:'luanne'}); create (a:Attendee {name:'adam'}); create (a:Attendee {name:'christoph'}); create (a:Attendee {name:'vince'}); create (a:Attendee {name:'michal'}); 这个问题 MATCH p=(n:Attendee)-[r*0..1]-(m) WITH p order by

有关以下数据:

create (a:Attendee {name:'luanne'});
create (a:Attendee {name:'adam'});
create (a:Attendee {name:'christoph'});
create (a:Attendee {name:'vince'});
create (a:Attendee {name:'michal'});
这个问题

MATCH p=(n:Attendee)-[r*0..1]-(m) 
WITH p order by head(nodes(p)).name 
return collect(distinct(p))
当通过长度为1的shell返回路径执行时,按路径中第一个节点的名称排序

但是,通过REST API:

POST http://localhost:7474/db/data/transaction/commit
{"statements":[ 
{"statement":"MATCH p=(n:`Attendee`)-[r*0..1]-(m) WITH p order by head(nodes(p)).name return collect(distinct(p))","parameters":{},"resultDataContents":["graph"]}
]}]}
不维护相同的顺序(看起来是按节点id排序的)

如何修复密码以获得与通过shell执行时相同的结果


如果resultDataContents为“row”,并且在REST中没有使用COLLECT,则PS.可以正常工作。在这种情况下,不需要COLLECT

返回不同的p
就足够了


在resultDataContents“graph”中,它使用集合重新处理响应,以唯一地收集响应的节点和关系。很有可能订单丢失。

嗨,Michael,我们使用Collect来最大限度地减少通过网络发送的密码数量。我们返回一行,所有不同的节点,然后是所有不同的关系。没有它,在“图形”格式中,对于从节点A到某个其他节点B的每条路径,重复关于节点A的信息。这会极大地增加密码响应,最终我们会在客户端多次处理相同的节点数据。这是没有办法的吗?