Count the number of results for the query directly

This commit is contained in:
Ka Yue Yeung 2015-04-18 00:42:02 +08:00
parent adf7fb21e3
commit e71ec4ac8a

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