Skip to content
This repository has been archived by the owner on May 13, 2021. It is now read-only.

Commit

Permalink
Revert "Fix getTotalCount() method" (#96)
Browse files Browse the repository at this point in the history
Co-authored-by: Jordan Massart <[email protected]>
  • Loading branch information
curquiza and shokme authored Feb 3, 2021
1 parent 802635d commit 93bd366
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/Engines/MeilisearchEngine.php
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ public function map(Builder $builder, $results, $model)
*/
public function getTotalCount($results)
{
return count($results['hits']);
return $results['nbHits'];
}

/**
Expand Down
6 changes: 3 additions & 3 deletions tests/MeilisearchEngineTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ public function mapIdsReturnsEmptyCollectionIfNoHits()
$engine = new MeilisearchEngine($client);

$results = $engine->mapIds([
'hits' => [],
'nbHits' => 0, 'hits' => [],
]);

$this->assertEquals(0, count($results));
Expand All @@ -156,7 +156,7 @@ public function mapCorrectlyMapsResultsToModels()
$builder = m::mock(Builder::class);

$results = $engine->map($builder, [
'hits' => [
'nbHits' => 1, 'hits' => [
['id' => 1],
],
], $model);
Expand All @@ -182,7 +182,7 @@ public function mapMethodRespectsOrder()
$builder = m::mock(Builder::class);

$results = $engine->map($builder, [
'hits' => [
'nbHits' => 4, 'hits' => [
['id' => 1],
['id' => 2],
['id' => 4],
Expand Down

0 comments on commit 93bd366

Please sign in to comment.