From 2b2093af969da58f1c80f2510675dc5387806718 Mon Sep 17 00:00:00 2001 From: foesa <35463247+foesa-yang@users.noreply.github.com> Date: Fri, 29 Jul 2022 10:44:06 +0800 Subject: [PATCH 1/2] Update 2.match.md --- .../7.general-query-statements/2.match.md | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/docs-2.0/3.ngql-guide/7.general-query-statements/2.match.md b/docs-2.0/3.ngql-guide/7.general-query-statements/2.match.md index f55f64fafe0..aa51d7d4caa 100644 --- a/docs-2.0/3.ngql-guide/7.general-query-statements/2.match.md +++ b/docs-2.0/3.ngql-guide/7.general-query-statements/2.match.md @@ -555,6 +555,22 @@ nebula> MATCH (v1:player{name:"Tim Duncan"}), (v2:team{name:"Spurs"}) \ +----------------------------------------------------+----------------------------------+ ``` +### 匹配最短路径 + +用户可以用 `shortestPath` 表示模式中的路径。 + +``` +nebula> MATCH p = shortestPath((a:player)-[e:follow*..2]-(b:player))\ + WHERE a.player.age > 45 AND b.player.age < 30 \ + RETURN p; ++---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ +| p | ++---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ +| <("player144" :player{age: 47, name: "Shaquille O'Neal"})-[:follow@0 {degree: 80}]->("player100" :player{age: 42, name: "Tim Duncan"})<-[:follow@0 {degree: 99}]-("player113" :player{age: 29, name: "Dejounte Murray"})> | ++---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ +``` + + ## 多MATCH检索 不同的模式有不同的筛选条件时,可以使用多`MATCH`,会返回模式完全匹配的行。 From c315b17360c7f9f3996f9aa47bac97b5feb06cb4 Mon Sep 17 00:00:00 2001 From: randomJoe211 <69501902+randomJoe211@users.noreply.github.com> Date: Fri, 29 Jul 2022 14:30:44 +0800 Subject: [PATCH 2/2] Update docs-2.0/3.ngql-guide/7.general-query-statements/2.match.md --- docs-2.0/3.ngql-guide/7.general-query-statements/2.match.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/docs-2.0/3.ngql-guide/7.general-query-statements/2.match.md b/docs-2.0/3.ngql-guide/7.general-query-statements/2.match.md index aa51d7d4caa..25de31f09d0 100644 --- a/docs-2.0/3.ngql-guide/7.general-query-statements/2.match.md +++ b/docs-2.0/3.ngql-guide/7.general-query-statements/2.match.md @@ -569,8 +569,6 @@ nebula> MATCH p = shortestPath((a:player)-[e:follow*..2]-(b:player))\ | <("player144" :player{age: 47, name: "Shaquille O'Neal"})-[:follow@0 {degree: 80}]->("player100" :player{age: 42, name: "Tim Duncan"})<-[:follow@0 {degree: 99}]-("player113" :player{age: 29, name: "Dejounte Murray"})> | +---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ ``` - - ## 多MATCH检索 不同的模式有不同的筛选条件时,可以使用多`MATCH`,会返回模式完全匹配的行。