'Get a generator to iterate over all search results
Transparently handles the results paging from Cloudsearch
search results so even if you have many thousands of results
you can iterate over all results in a reasonably efficient
manner.
:type query: :class:`boto.cloudsearch2.search.Query`
:param query: A group of search criteria
:rtype: generator
:return: All docs matching query'

def get_all_hits(self, query):

    page = 0
    num_pages_needed = 0
    while (page <= num_pages_needed):
        results = self(query)
        num_pages_needed = results.num_pages_needed
        for doc in results:
            (yield doc)
        query.start += query.real_size
        page += 1
