mirror of
https://github.com/Codappix/search_core.git
synced 2024-11-26 07: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 = [];
|
protected $results = [];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* For Iterator interface.
|
||||||
|
*
|
||||||
|
* @var int
|
||||||
|
*/
|
||||||
|
protected $position = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var ObjectManagerInterface
|
* @var ObjectManagerInterface
|
||||||
*/
|
*/
|
||||||
|
@ -121,27 +128,29 @@ class SearchResult implements SearchResultInterface
|
||||||
// Iterator - Interface
|
// Iterator - Interface
|
||||||
public function current()
|
public function current()
|
||||||
{
|
{
|
||||||
return $this->result->current();
|
return $this->getResults()[$this->position];
|
||||||
}
|
}
|
||||||
|
|
||||||
public function next()
|
public function next()
|
||||||
{
|
{
|
||||||
return $this->result->next();
|
++$this->position;
|
||||||
|
|
||||||
|
return $this->current();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function key()
|
public function key()
|
||||||
{
|
{
|
||||||
return $this->result->key();
|
return $this->position;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function valid()
|
public function valid()
|
||||||
{
|
{
|
||||||
return $this->result->valid();
|
return isset($this->getResults()[$this->position]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function rewind()
|
public function rewind()
|
||||||
{
|
{
|
||||||
$this->result->rewind();
|
$this->position = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Extbase QueryResultInterface - Implemented to support Pagination of Fluid.
|
// Extbase QueryResultInterface - Implemented to support Pagination of Fluid.
|
||||||
|
|
Loading…
Reference in a new issue