mirror of
https://github.com/Codappix/search_core.git
synced 2024-11-24 02:16:11 +01:00
Merge pull request #67 from Codappix/feature/allow-exchange-of-limit
TASK: Allow sub indexer to exchange limit
This commit is contained in:
commit
b42de0576a
1 changed files with 12 additions and 2 deletions
|
@ -83,8 +83,7 @@ abstract class AbstractIndexer implements IndexerInterface
|
||||||
protected function getRecordGenerator()
|
protected function getRecordGenerator()
|
||||||
{
|
{
|
||||||
$offset = 0;
|
$offset = 0;
|
||||||
// TODO: Make configurable.
|
$limit = $this->getLimit();
|
||||||
$limit = 50;
|
|
||||||
|
|
||||||
while (($records = $this->getRecords($offset, $limit)) !== []) {
|
while (($records = $this->getRecords($offset, $limit)) !== []) {
|
||||||
yield $records;
|
yield $records;
|
||||||
|
@ -92,6 +91,17 @@ abstract class AbstractIndexer implements IndexerInterface
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the limit to use to fetch records.
|
||||||
|
*
|
||||||
|
* @return int
|
||||||
|
*/
|
||||||
|
protected function getLimit()
|
||||||
|
{
|
||||||
|
// TODO: Make configurable.
|
||||||
|
return 50;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param int $offset
|
* @param int $offset
|
||||||
* @param int $limit
|
* @param int $limit
|
||||||
|
|
Loading…
Reference in a new issue