提问参考模版:
- nebula 版本: 3.4.1
- 部署方式:分布式
- 安装方式: RPM
- 是否上生产环境:Y
- 硬件信息
- 磁盘( 推荐使用 SSD)
- CPU、内存信息
- 问题的具体描述
在查找Company 和Org 之间是否存在最短路径,但是有个额外的过滤条件就是,如果路径中有除了尾部节点之外,如果还有Org, 那么要求中间的Vertex 必须和尾部节点的OrgD 的id 相同
原始:
find shortest path with prop from -2886766351330904521 to -4689798059594532991 over Legal, Customer BIDIRECT upto 3 steps YIELD path AS p
路径大概 如下: ComA - ComB - ComC - OrgD
添加过滤条件:
find shortest path with prop from -2886766351330904521 to -4689798059594532991 over Legal, Customer BIDIRECT upto 3 steps YIELD path AS p | YIELD $-.p AS pp WHERE ALL(n IN NODES($-.p) WHERE (labels(n)[0] == "Org" and properties(n).orgid == "208") OR labels(n)[0] != "Org")
但是发现这样写法结果是空,反而去掉首尾节点的过滤可以成功,我理解这个语义应该是对的才对,这个为什么呢?
find shortest path with prop from -2886766351330904521 to -4689798059594532991 over Legal, Customer BIDIRECT upto 3 steps YIELD path AS p | YIELD $-.p AS pp WHERE ALL(n IN NODES($-.p)[1..-1] WHERE (labels(n)[0] == "Org" and properties(n).orgid == "208") OR labels(n)[0] != "Org")
这个写法有返回结果