【发布时间】:2014-01-17 11:58:54
【问题描述】:
我正在使用 blueprints api 来查询 Titan 图形数据库。我处于需要对顶点属性执行通配符搜索的情况。有没有办法使用通配符查询具有属性的顶点?类似于关系数据库中的“PropertyName like '%asdf%'”。
【问题讨论】:
标签: database graph elasticsearch titan
我正在使用 blueprints api 来查询 Titan 图形数据库。我处于需要对顶点属性执行通配符搜索的情况。有没有办法使用通配符查询具有属性的顶点?类似于关系数据库中的“PropertyName like '%asdf%'”。
【问题讨论】:
标签: database graph elasticsearch titan
您可以在此处了解如何进行基于字符串的搜索:
https://github.com/thinkaurelius/titan/wiki/Full-Text-and-String-Search#string-search
在您的情况下,您可能需要使用基于 Text.REGEX 的搜索,因为您想要评估字符串的两侧。您可以使用 Query API 使用 Blueprints API 执行此操作,如下所示:
graph.query().has("name",Text.REGEX,".*asdf.*").vertices()
【讨论】:
在 Gremlin v2 中,我这样做:
g.v.has('name',REGEX,'.*asdf.*').map
【讨论】: