Optimizing search functionality

So the number of evaluations is less than num_tags * num_tickets. We get a list of all tickets corresponding to all tags and then filter it. So imagine ~tag to return a list of all tickets corresponding to all tickets and filtering is performed for each of those. An optimization that I think Dgraph could do is that we could come up with a between operator which can filter the value within a range. It would be interesting to see how that impacts the performance.

{
  q(func: has(is_tag)) {
      name
      count(~tag @filter(between(created_at, "2017-01-01T00:00:00Z", "2017-01-31T00:00:00Z")))
  }
}

Adding an organization to reduce the number of tickets and hence tags would be helpful for sure as lesser tickets and tags would be fetched and evaluated against. You could even do it in a single query using variables.