Dgraph: Search on non-indexed predicates

Created on 3 Apr 2018  路  3Comments  路  Source: dgraph-io/dgraph

It's acceptable to have _some_ performance degradation, but there's certainly a need to be able to search on predicates that are not indexed.

If there are billions of vertices with millions of predicates, it does not seem like a good idea to index all predicates. This means that searching on those predicates is not possible. There needs to be _some_ way of searching without indexing.

Most helpful comment

We've found a workaround for this since the issue was initially filed. For anyone else curious about this:

{
  var(func: has(pred_to_be_searched)) {
    p as pred_to_be_searched
  }
  query(func: eq(val(p), "value-searching-for")) {
    pred_to_be_searched
  }
}

All 3 comments

There is a function for this https://docs.dgraph.io/query-language#has

I believe that this answer the question. If the question is to create Search in non-indexed predicates via functions that need to be explicitly indexed (Like "allofterms"). I think it's impossible. Because you would need to build several types of indexes at first to get this. That would take up a lot of space.

Feel free to reopen if needed.

We've found a workaround for this since the issue was initially filed. For anyone else curious about this:

{
  var(func: has(pred_to_be_searched)) {
    p as pred_to_be_searched
  }
  query(func: eq(val(p), "value-searching-for")) {
    pred_to_be_searched
  }
}

This is a good solution. @kdsgambhir we should document this in our docs.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

yupengfei picture yupengfei  路  4Comments

xhochipe picture xhochipe  路  3Comments

djdoeslinux picture djdoeslinux  路  4Comments

jeffkhull picture jeffkhull  路  3Comments

pjebs picture pjebs  路  4Comments