Skip to content

Commit

Permalink
Fixes wrong index issue on filtered results
Browse files Browse the repository at this point in the history
  • Loading branch information
jamesmoss committed Jun 4, 2015
1 parent a2c82f5 commit 7811474
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/JamesMoss/Flywheel/Result.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class Result implements \IteratorAggregate, \ArrayAccess, \Countable
*/
public function __construct($documents, $total)
{
$this->documents = $documents;
$this->documents = array_values($documents);
$this->total = $total;
}

Expand Down
10 changes: 5 additions & 5 deletions test/JamesMoss/Flywheel/ResultTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -129,11 +129,11 @@ public function testHash()
protected function getTestResult()
{
return new Result(array(
new Document(array('id' => 6, 'name' => 'Bob Jones', 'age' => 35)),
new Document(array('id' => 7, 'name' => 'Fred Smith', 'age' => 19)),
new Document(array('id' => 3, 'name' => 'John Appleseed', 'age' => 43)),
new Document(array('id' => 9, 'name' => 'Mary Jones', 'age' => 37)),
new Document(array('id' => 1, 'name' => 'Katie Smith', 'age' => 21)),
1 => new Document(array('id' => 6, 'name' => 'Bob Jones', 'age' => 35)),
4 => new Document(array('id' => 7, 'name' => 'Fred Smith', 'age' => 19)),
6 => new Document(array('id' => 3, 'name' => 'John Appleseed', 'age' => 43)),
7 => new Document(array('id' => 9, 'name' => 'Mary Jones', 'age' => 37)),
8 => new Document(array('id' => 1, 'name' => 'Katie Smith', 'age' => 21)),
), 5);
}

Expand Down

0 comments on commit 7811474

Please sign in to comment.