mirror of
https://github.com/Codappix/search_core.git
synced 2024-11-23 07:56:12 +01:00
[BUGFIX] Make sure the while loop is not closed
When filterRecordsByRootLineBlacklist() returns no results, loop should just ask the next items based on iteration
This commit is contained in:
parent
f1eb85de64
commit
9b0b0305a7
2 changed files with 13 additions and 5 deletions
|
@ -122,8 +122,10 @@ abstract class AbstractIndexer implements IndexerInterface
|
||||||
$offset = 0;
|
$offset = 0;
|
||||||
$limit = $this->getLimit();
|
$limit = $this->getLimit();
|
||||||
|
|
||||||
while (($records = $this->getRecords($offset, $limit)) !== []) {
|
while (($records = $this->getRecords($offset, $limit)) !== null) {
|
||||||
yield $records;
|
if (!empty($records)) {
|
||||||
|
yield $records;
|
||||||
|
}
|
||||||
$offset += $limit;
|
$offset += $limit;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -194,7 +196,10 @@ abstract class AbstractIndexer implements IndexerInterface
|
||||||
return $this->identifier;
|
return $this->identifier;
|
||||||
}
|
}
|
||||||
|
|
||||||
abstract protected function getRecords(int $offset, int $limit): array;
|
/**
|
||||||
|
* @return array|null Nullable when no items are found and execution should be stopped
|
||||||
|
*/
|
||||||
|
abstract protected function getRecords(int $offset, int $limit);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @throws NoRecordFoundException If record could not be found.
|
* @throws NoRecordFoundException If record could not be found.
|
||||||
|
|
|
@ -49,11 +49,14 @@ class TcaIndexer extends AbstractIndexer
|
||||||
$this->tcaTableService = $tcaTableService;
|
$this->tcaTableService = $tcaTableService;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function getRecords(int $offset, int $limit): array
|
/**
|
||||||
|
* @return array|null Nullable when no items are found and execution should be stopped
|
||||||
|
*/
|
||||||
|
protected function getRecords(int $offset, int $limit)
|
||||||
{
|
{
|
||||||
$records = $this->tcaTableService->getRecords($offset, $limit);
|
$records = $this->tcaTableService->getRecords($offset, $limit);
|
||||||
if ($records === []) {
|
if ($records === []) {
|
||||||
return [];
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->tcaTableService->filterRecordsByRootLineBlacklist($records);
|
$this->tcaTableService->filterRecordsByRootLineBlacklist($records);
|
||||||
|
|
Loading…
Reference in a new issue