From 555bc52f6ee78fc9ef4ec1d586a8394f2547fb54 Mon Sep 17 00:00:00 2001 From: cooper-lzy <78672629+cooper-lzy@users.noreply.github.com> Date: Fri, 29 Oct 2021 14:15:45 +0800 Subject: [PATCH 1/3] Update 1.create-native-index.md --- .../1.create-native-index.md | 28 +++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/docs-2.0/3.ngql-guide/14.native-index-statements/1.create-native-index.md b/docs-2.0/3.ngql-guide/14.native-index-statements/1.create-native-index.md index c6b398725a..0d2a891198 100644 --- a/docs-2.0/3.ngql-guide/14.native-index-statements/1.create-native-index.md +++ b/docs-2.0/3.ngql-guide/14.native-index-statements/1.create-native-index.md @@ -124,3 +124,31 @@ nebula> CREATE TAG INDEX player_index_1 on player(name(10), age); !!! caution 不支持跨Tag或Edge type创建复合索引。 + +!!! note + + 使用复合属性索引时,遵循"最左匹配原则",必须从复合属性索引的最左侧开始匹配。需要注意的是: + + - 如果`LOOKUP`语句没有匹配复合属性索引,会走点的索引查询。 + + - 如果`MATCH`语句没有匹配复合属性索引,会返回报错。 + + 请参见下方示例。 + + ```ngql + # 为标签t的前三个属性创建复合属性索引。 + nebula> CREATE TAG INDEX example_index ON TAG t(p1, p2, p3); + + # 注意:无法匹配到索引,因为不是从p1开始,会返回找不到有效索引的报错。 + nebula> MATCH (v:t) WHERE t.p2 == 2 and t.p3 == 3; + + # 注意:无法匹配到索引,但是可以通过VID的默认索引查询。 + nebula> LOOKUP ON t2 where t.p2 == 2; + + # 可以匹配到索引。 + nebula> MATCH (v:t) WHERE t.p1 == 1; + # 可以匹配到索引,因为p1和p2是连续的。 + nebula> MATCH (v:t) WHERE t.p1 == 1 and t.p2 == 2; + # 可以匹配到索引,因为p1、p2、p3是连续的。 + nebula> MATCH (v:t) WHERE t.p1 == 1 and t.p2 == 2 and t.p3 == 3; + ``` From d1cc24f2749c3edcb6dada1a0c78c576275b6877 Mon Sep 17 00:00:00 2001 From: cooper-lzy <78672629+cooper-lzy@users.noreply.github.com> Date: Fri, 29 Oct 2021 15:08:37 +0800 Subject: [PATCH 2/3] Update 1.create-native-index.md --- .../14.native-index-statements/1.create-native-index.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/docs-2.0/3.ngql-guide/14.native-index-statements/1.create-native-index.md b/docs-2.0/3.ngql-guide/14.native-index-statements/1.create-native-index.md index 0d2a891198..388a04feec 100644 --- a/docs-2.0/3.ngql-guide/14.native-index-statements/1.create-native-index.md +++ b/docs-2.0/3.ngql-guide/14.native-index-statements/1.create-native-index.md @@ -127,7 +127,9 @@ nebula> CREATE TAG INDEX player_index_1 on player(name(10), age); !!! note - 使用复合属性索引时,遵循"最左匹配原则",必须从复合属性索引的最左侧开始匹配。需要注意的是: + 使用复合属性索引时,遵循"最左匹配原则",必须从复合属性索引的最左侧开始匹配。 + From aeb435fecbb47046f330289e5905513cacb38b5b Mon Sep 17 00:00:00 2001 From: cooper-lzy <78672629+cooper-lzy@users.noreply.github.com> Date: Fri, 29 Oct 2021 15:09:20 +0800 Subject: [PATCH 3/3] Update 1.create-native-index.md --- .../14.native-index-statements/1.create-native-index.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs-2.0/3.ngql-guide/14.native-index-statements/1.create-native-index.md b/docs-2.0/3.ngql-guide/14.native-index-statements/1.create-native-index.md index 388a04feec..268172fabd 100644 --- a/docs-2.0/3.ngql-guide/14.native-index-statements/1.create-native-index.md +++ b/docs-2.0/3.ngql-guide/14.native-index-statements/1.create-native-index.md @@ -131,7 +131,7 @@ nebula> CREATE TAG INDEX player_index_1 on player(name(10), age);