code: def _do_query_facets(self, results, query_facets):
          
          facet_dict = {}
          for field, query in list(dict(query_facets).items()):
              facet_dict[field] = (query, self.search(self.parse_query(query))['hits'])
  
          return facet_dict
docs: Private method that facets a document by query
  
          Required arguments:
              `results` -- A list SearchResults to facet
              `query_facets` -- A dictionary containing facet parameters:
                  {'field': 'query', [...]}
  
          For each query in `query_facets`, generates a dictionary entry with
          the field name as the key and a tuple with the query and result count
          as the value.
  
          eg. {'name': ('a*', 5)}