原生索引可以基于指定属性查询数据有如下特点,最后一个- 不支持CONTAINS和STARTS WITH等字符串操作符。这个该怎么理解?我测试是可以的

nebula 版本:nebula-graph-2.0.0.el7.x86_64.rpm

  • 部署方式(分布式 / 单机 / Docker / DBaaS):分布式 三节点
  • 是否为线上版本:N
  • 硬件信息
    • 磁盘( 推荐使用 SSD):SSD
    • CPU、内存信息 每天64核,512G(和其他应用公用,可用磁盘空间约1T)
  • 问题的具体描述
  • 相关的 meta / storage / graph info 日志信息
(root@nebula) [testindex1]> show tag indexes
+---------------------+
| Names               |
+---------------------+
| "index_player"      |
+---------------------+
| "index_player_name" |
+---------------------+
| "index_tag"         |
+---------------------+
Got 3 rows (time spent 1462/1964 us)

Thu, 20 May 2021 10:52:53 CST

(root@nebula) [testindex1]> MATCH (v:player)  WHERE v.name STARTS WITH "T"  RETURN v.name, v.age;
+------------------+-------+
| v.name           | v.age |
+------------------+-------+
| "Tracy McGrady"  | 39    |
+------------------+-------+
| "Tiago Splitter" | 34    |
+------------------+-------+
| "Tim Duncan"     | 42    |
+------------------+-------+
| "Tony ma"        | 36    |
+------------------+-------+
Got 4 rows (time spent 6819/7417 us)

Thu, 20 May 2021 10:53:02 CST
(root@nebula) [testindex1]> MATCH (v:player) \
                         ->         WHERE v.name CONTAINS "Pa" \
                         ->         RETURN v.name, v.age;
+---------------+-------+
| v.name        | v.age |
+---------------+-------+
| "Chris Paul"  | 33    |
+---------------+-------+
| "Paul George" | 28    |
+---------------+-------+
| "Paul Gasol"  | 38    |
+---------------+-------+
Got 3 rows (time spent 76738/77213 us)

Thu, 20 May 2021 10:59:37 CST

可以啊,为什么文档中说不可以呢?

再试试其他的

(root@nebula) [testindex1]> LOOKUP ON player WHERE player.name starts with "T";
[ERROR (-12)]: SemanticError: Expression (player.name STARTS WITH "T") not supported yet
(root@nebula) [testindex1]>  GO FROM "player100" OVER follow REVERSELY \
                         ->         YIELD follow._dst AS id | \
                         ->         GO FROM $-.id OVER serve \
                         ->         WHERE $^.player.name starts with "T" \
                         ->         YIELD $^.player.name AS FriendOf, $$.team.name AS Team;
+------------------+-----------+
| FriendOf         | Team      |
+------------------+-----------+
| "Tony ma"        | "Hornets" |
+------------------+-----------+
| "Tony ma"        | "Spurs"   |
+------------------+-----------+
| "Tiago Splitter" | "Hawks"   |
+------------------+-----------+
| "Tiago Splitter" | "Spurs"   |
+------------------+-----------+
| "Tiago Splitter" | "76ers"   |
+------------------+-----------+
Got 5 rows (time spent 6740/7259 us)

Thu, 20 May 2021 11:03:19 CST

(root@nebula) [testindex1]>  GO FROM "player100" OVER follow REVERSELY         YIELD follow._dst AS id |         GO FROM $-.id OVER serve         WHERE $^.player.name contains  "T"         YIELD $^.player.name AS FriendOf, $$.team.name AS Team;
+------------------+-----------+
| FriendOf         | Team      |
+------------------+-----------+
| "Tony ma"        | "Hornets" |
+------------------+-----------+
| "Tony ma"        | "Spurs"   |
+------------------+-----------+
| "Tiago Splitter" | "Hawks"   |
+------------------+-----------+
| "Tiago Splitter" | "Spurs"   |
+------------------+-----------+
| "Tiago Splitter" | "76ers"   |
+------------------+-----------+
Got 5 rows (time spent 6605/7132 us)

Thu, 20 May 2021 11:03:55 CST

综上,原生索引可以基于指定属性查询数据有如下特点,最后一个- 不支持CONTAINS和STARTS WITH等字符串操作符。这个该怎么理解?

感谢反馈,这里用词不严谨,需要修改下。
lookup语句不支持,match语句可以执行。

那match 是怎么支持的?我看starts with ends with contains 给的查询语句都是以match开头的。

这句话是不是说lookup 不支持starts with ends with contains 等模糊查询操作?

Match 会对tag下所有点扫描再做过滤,这几个表达式目前还不支持下推

这句话是不是说lookup 不支持starts with ends with contains 等模糊查询操作?

对,暂不支持

好的,明白了。建议就改成不支持starts with ends with contains 等操作。。简单明了,不会让人多想

谢谢你的反馈,我们会尽快更新这部分的文档

浙ICP备20010487号