Merge pull request #860 from kayue/patch-1

Count the number of results for the query directly
This commit is contained in:
Tim Nagel 2015-04-28 12:56:12 +10:00
commit 4451bd07c6

View file

@ -121,7 +121,7 @@ class RawPaginatorAdapter implements PaginatorAdapterInterface
public function getTotalHits($genuineTotal = false) public function getTotalHits($genuineTotal = false)
{ {
if (! isset($this->totalHits)) { if (! isset($this->totalHits)) {
$this->totalHits = $this->searchable->search($this->query)->getTotalHits(); $this->totalHits = $this->searchable->count($this->query);
} }
return $this->query->hasParam('size') && !$genuineTotal return $this->query->hasParam('size') && !$genuineTotal