lugensa / scorched

Sunburnt offspring solr client
MIT License
27 stars 19 forks source link

__len__ method on SolrResponse only returns number of rows #45

Closed mlissner closed 7 years ago

mlissner commented 7 years ago

The SolrReponse object has a __len__ method that has very simple code right now:

def __len__(self):
    if self.groups:
        return len(getattr(self.groups, self.group_field)['groups'])
    else:
        return len(self.result.docs)

The third line of that I wrote, copying the code from the last line, but both are wrong. The updated code should be:

def __len__(self):
    if self.groups:
        return getattr(self.groups, self.group_field)['ngroups']
    else:
        return self.result.numFound

This way things like paginators will be able to know the full size of the response.

delijati commented 7 years ago

Merged