Faceted search support

As posted in https://github.com/dgraph-io/dgraph/issues/671, there is some interest in implementation of faceted search for Dgraph.

Some resources:

  1. General description: https://en.wikipedia.org/wiki/Faceted_search
  2. Example of faceted search: https://blog.linkedin.com/2009/12/14/linkedin-faceted-search
  3. Bleve documentation: http://www.blevesearch.com/docs/Result-Faceting/

This kind of search is currently possible in Dgraph. For example, following query shows 3 “search facets” of genre attribute (of director), for steven spielberg search.

  var(func:allofterms(name, "steven spielberg")) {
    director.film @groupby(genre) {
      a as count(_uid_)

  byGenre(id: var(a), orderdesc: var(a), first: 3) {
    total_movies : var(a)

Probably some syntactic sugar for such aggregation can be added to simplify queries. All comments and suggestions welcome.

Hi, I wasn’t really clear on what would be added. It looked like Dgraph can already do the kinds of queries that faceted search requires, but we might add some syntax to simplify the queries, is that right? In which case do we know what would be a helpful general mechanism.

I would have thought faceted searches would be something that a user would build on top of Dgraph as part of their application. Unless we are thinking of it as part of schema exploration tool in the UI.

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.