Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update 2.match.md #2385

Merged
merged 7 commits into from
Dec 14, 2022
Merged
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 9 additions & 4 deletions docs-2.0/3.ngql-guide/7.general-query-statements/2.match.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,22 +26,27 @@ MATCH <pattern> [<clause_1>] RETURN <output> [<clause_2>];

## 注意事项

除以下三种情况之外,请确保 `MATCH` 语句有**至少**一个[索引](../14.native-index-statements/1.create-native-index.md)可用
未创建[索引](../14.native-index-statements/1.create-native-index.md)时,仅以下情况支持使用`MATCH`查询。当`MATCH`语句出现报错时,用户可以创建并重建索引后执行该语句
abby-cyber marked this conversation as resolved.
Show resolved Hide resolved

- `MATCH`语句中`WHERE`子句使用 id() 函数指定了点的 VID,不需要创建索引即可执行。

- 当遍历所有点边时,例如`MATCH (v) RETURN v LIMIT N`,不需要创建索引,但必须使用`LIMIT`限制输出结果数量
- 当遍历所有点或边时,例如`MATCH (v) RETURN v LIMIT N`、`MATCH ()-[e]->() RETURN e LIMIT N`

- 当遍历指定 Tag 的点或指定 Edge Type 的边时,例如`MATCH (v:player) RETURN v LIMIT N`,不需要创建索引,但必须使用`LIMIT`限制输出结果数量。
- 当遍历指定 Tag 的点,例如`MATCH (v:player) RETURN v LIMIT N`。

- 当遍历指定 Edge Type 并指定边的方向,例如`MATCH ()-[e:follow]->() RETURN e LIMIT N`。

!!! note

目前 MATCH 语句无法查询到悬挂边。
- 目前 MATCH 语句无法查询到悬挂边。
- 不支持没有索引时同时遍历指定的 Tag 和 Edge Type,例如执行`MATCH (v:player)-[e:follow]->() RETURN e LIMIT N`会报错。

!!! compatibility "历史版本兼容性"

从 3.0.0 版本开始,为了区别不同 Tag 的属性,返回属性时必须额外指定 Tag 名称。即从`RETURN <变量名>.<属性名>`改为`RETURN <变量名>.<Tag名>.<属性名>`。



## 示例

### 创建索引
Expand Down