1.希望获取节点全部属性并排序,下面语句前面排序后,在fetch * 查询全部属性但是前面排序字段结果后面全部属性中无效
GO FROM 34580 OVER Singer_song YIELD Singer_song._dst AS Singer_song | FETCH PROP ON Thing $-.Singer_song YIELD Thing.Thing_popularity AS Thing_popularity | ORDER BY $-.Thing_popularity DESC |limit 10 |fetch prop on * $-.VertexID
2.用match 实现但是性能不高
MATCH (v:Thing)-[e:Singer_song]->(v2)
WHERE id(v) == 34580
RETURN id(v2),v2.Thing_popularity as Thing_popularity ,v2
ORDER BY Thing_popularity desc LIMIT 3
你的需求是 做一跳查询, 对查询结果的每个vertex查询所有属性, 然后按照某个属性排序吗?
是的先一条查出目标节点ID,再根据目标节点的字段排序,然后取前10条,在通过vid fetch * 查出节点全部字段,但是最后一个fetch 没有保留上一次vid 的排序,就是问这个问题怎么处理,下面我用match 也可实现了,但是查询性能太慢
1 个赞
需要从前面一个 fetch 的 yield 子句透传全部属性。这是我本地测试:
(root@nebula) [nba]> GO FROM "Tim Duncan" OVER like YIELD like._dst AS dst | FETCH PROP ON * $-.dst YIELD player.age AS age,vertex AS allProperties | ORDER BY $-.age | LIMIT 3 | YIELD $-.allProperties AS allProperties
+-----------------------------------------------------------+
| allProperties |
+-----------------------------------------------------------+
| ("Tony Parker" :player{age: 36, name: "Tony Parker"}) |
| ("Manu Ginobili" :player{age: 41, name: "Manu Ginobili"}) |
+-----------------------------------------------------------+
Got 2 rows (time spent 4378/4719 us)
1 个赞
此话题已在最后回复的 7 天后被自动关闭。不再允许新回复。