【问题标题】:Titan graph database: speed up AND and OR gremlin queries using the Indexing backendsTitan 图形数据库:使用索引后端加速 AND 和 OR gremlin 查询
【发布时间】:2016-10-05 04:57:02
【问题描述】:

我在生产中使用了 Titan 1.0。 (Cassandra + Solr) 我想知道如何通过索引后端加快 AND/OR 查询。假设在“user_info”和“vertex_label”字段上定义了混合索引。如何告诉 Titan 使用索引后端作为以下查询或其他类似查询的数据准备源:

g.V().or(__.has("user_info",Text.textRegex("job=Teacher")),
      __.has("vertext_label","user")))

我已经使用 query.force-index=true 检查了这个查询,看看它是否使用任何类型的索引;但抛出的异常表明它没有。

【问题讨论】:

    标签: solr cassandra titan gremlin


    【解决方案1】:

    在 Aurelius 邮件列表上是 answered,但由于 SO 更喜欢文本而不是链接,所以这里又是:

    将其拆分为 2 个查询并合并结果:

    result = g.V().has("user_info", Text.textRegex("job=Teacher")).toSet()
    result.addAll(g.V().has("vertex_label", "user"))
    

    或者使用中间遍历索引查找(需要 TP 3.2):

    g.V().has("user_info", Text.textRegex("job=Teacher")).aggregate("x").cap("x").
      V().has("vertex_label", "user").aggregate("x").cap("x")
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2017-10-17
      • 1970-01-01
      • 1970-01-01
      • 2015-11-11
      • 1970-01-01
      • 2014-06-28
      • 2016-05-15
      相关资源
      最近更新 更多