Skip to content

Commit

Permalink
Stats returns number without from and size parameters, so we must cou…
Browse files Browse the repository at this point in the history
…nt hits that really exits in collection
  • Loading branch information
Spamercz committed Sep 20, 2023
1 parent 034c32f commit e03dbaa
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/Response/Result/HitCollection.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
namespace Spameri\ElasticQuery\Response\Result;


class HitCollection implements \IteratorAggregate
class HitCollection implements \IteratorAggregate, \Countable
{

/**
Expand All @@ -25,4 +25,10 @@ public function getIterator(): \ArrayIterator
return new \ArrayIterator($this->hits);
}


public function count(): int
{
return \count($this->hits);
}

}

0 comments on commit e03dbaa

Please sign in to comment.