mirror of
https://github.com/Codappix/search_core.git
synced 2024-11-22 14:56:12 +01:00
BUGFIX: Allow iteration / pagination of result items
Implement necessary logic based on mapped result items, not elastica result items.
This commit is contained in:
parent
d45d231585
commit
b31f315ec4
1 changed files with 14 additions and 5 deletions
|
@ -48,6 +48,13 @@ class SearchResult implements SearchResultInterface
|
|||
*/
|
||||
protected $results = [];
|
||||
|
||||
/**
|
||||
* For Iterator interface.
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
protected $position = 0;
|
||||
|
||||
/**
|
||||
* @var ObjectManagerInterface
|
||||
*/
|
||||
|
@ -121,27 +128,29 @@ class SearchResult implements SearchResultInterface
|
|||
// Iterator - Interface
|
||||
public function current()
|
||||
{
|
||||
return $this->result->current();
|
||||
return $this->getResults()[$this->position];
|
||||
}
|
||||
|
||||
public function next()
|
||||
{
|
||||
return $this->result->next();
|
||||
++$this->position;
|
||||
|
||||
return $this->current();
|
||||
}
|
||||
|
||||
public function key()
|
||||
{
|
||||
return $this->result->key();
|
||||
return $this->position;
|
||||
}
|
||||
|
||||
public function valid()
|
||||
{
|
||||
return $this->result->valid();
|
||||
return isset($this->getResults()[$this->position]);
|
||||
}
|
||||
|
||||
public function rewind()
|
||||
{
|
||||
$this->result->rewind();
|
||||
$this->position = 0;
|
||||
}
|
||||
|
||||
// Extbase QueryResultInterface - Implemented to support Pagination of Fluid.
|
||||
|
|
Loading…
Reference in a new issue