From 2e80226680c41936ccf514b60e6696657bff31d9 Mon Sep 17 00:00:00 2001 From: Tyrone Tudehope Date: Thu, 5 Dec 2024 10:26:58 +0200 Subject: [PATCH] Ensure that hitsCount value is consistent --- src/Search/SearchResult.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/Search/SearchResult.php b/src/Search/SearchResult.php index d54c9bea..225197a6 100644 --- a/src/Search/SearchResult.php +++ b/src/Search/SearchResult.php @@ -58,7 +58,6 @@ public function __construct(array $body) $this->offset = $body['offset']; $this->limit = $body['limit']; $this->estimatedTotalHits = $body['estimatedTotalHits']; - $this->hitsCount = \count($body['hits']); } else { $this->numberedPagination = true; @@ -66,11 +65,11 @@ public function __construct(array $body) $this->page = $body['page']; $this->totalPages = $body['totalPages']; $this->totalHits = $body['totalHits']; - $this->hitsCount = $body['totalHits']; } $this->semanticHitCount = $body['semanticHitCount'] ?? 0; $this->hits = $body['hits'] ?? []; + $this->hitsCount = \count($body['hits']); $this->processingTimeMs = $body['processingTimeMs']; $this->query = $body['query']; $this->facetDistribution = $body['facetDistribution'] ?? [];