Is it possible to include SOLR-style facet counts in query responses?

Hello, I’m sorry to ask such a basic question but my team is evaluating possible graph databases for our use case and I’d like to determine if Dgraph can be the one :ring:

We need to return SOLR-style facet data counts in graph query responses.

For example, suppose our data describes people and each person has home_city and hair_color attributes. A user might query for all people in “Europe”, in which case we would use graph relations to find which people in the database have a home_city that falls within Europe.

Then we need to respond with facet counts indicating that in our DB, 100 of the people who live in Europe have blonde hair, 90 have brown hair, and so forth.

Is this a use case we can support at scale with Dgraph? Any pointers would be hugely helpful!

Not sure how SOLR’s response looks like. But I think it is really different. Please share an example, if can be in their docs.

Also, I see that they use a kind of XML. We don’t really support it. I think their JSON response and mutation are similar tho.

That’s aggregation. Aggregation - Query language


One note about “Facets”. In other DBs or data mining. “Facets” means another thing. In Dgraph a Facet is an extra set of keys that might work as “metadata” or anything you want. It is not a first-class citizen - which means you can’t index facets and query for it directly.