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

Commit 93bd366

Browse files
curquizashokme
andauthored
Revert "Fix getTotalCount() method" (#96)
Co-authored-by: Jordan Massart <hello@jordan-massart.be>
1 parent 802635d commit 93bd366

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/Engines/MeilisearchEngine.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ public function map(Builder $builder, $results, $model)
200200
*/
201201
public function getTotalCount($results)
202202
{
203-
return count($results['hits']);
203+
return $results['nbHits'];
204204
}
205205

206206
/**

tests/MeilisearchEngineTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ public function mapIdsReturnsEmptyCollectionIfNoHits()
138138
$engine = new MeilisearchEngine($client);
139139

140140
$results = $engine->mapIds([
141-
'hits' => [],
141+
'nbHits' => 0, 'hits' => [],
142142
]);
143143

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

158158
$results = $engine->map($builder, [
159-
'hits' => [
159+
'nbHits' => 1, 'hits' => [
160160
['id' => 1],
161161
],
162162
], $model);
@@ -182,7 +182,7 @@ public function mapMethodRespectsOrder()
182182
$builder = m::mock(Builder::class);
183183

184184
$results = $engine->map($builder, [
185-
'hits' => [
185+
'nbHits' => 4, 'hits' => [
186186
['id' => 1],
187187
['id' => 2],
188188
['id' => 4],

0 commit comments

Comments
 (0)