public function getNbResults() { if (isset($this->nbResults)) { return $this->nbResults; } $countQuery = clone $this->query; $countQuery->limit = 0; return $this->nbResults = $this->searchService->findLocations($countQuery)->totalCount; }