Skip to content

Commit

Permalink
Merge #701
Browse files Browse the repository at this point in the history
701: Ensure that hitsCount value is always consistent r=curquiza a=johnnynotsolucky

# Pull Request

## Related issue
Fixes #700 

## What does this PR do?
- Ensures that `SearchResults::hitsCount` is consistent regardless of whether `estimatedTotalHits` is set.

## PR checklist
Please check if your PR fulfills the following requirements:
- [x] Does this PR fix an existing issue, or have you listed the changes applied in the PR description (and why they are needed)?
- [x] Have you read the contributing guidelines?
- [x] Have you made sure that the title is accurate and descriptive of the changes?

Thank you so much for contributing to Meilisearch!


Co-authored-by: Tyrone Tudehope <tyronetudehope@gmail.com>
  • Loading branch information
meili-bors[bot] and johnnynotsolucky authored Dec 9, 2024
2 parents a1a414e + 2e80226 commit c5b229c
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions src/Search/SearchResult.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,19 +58,18 @@ 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;

$this->hitsPerPage = $body['hitsPerPage'];
$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'] ?? [];
Expand Down

0 comments on commit c5b229c

Please sign in to comment.