mirror of
https://github.com/Codappix/search_core.git
synced 2024-11-23 20:56:10 +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()
|
||||
{
|
||||
$offset = 0;
|
||||
// TODO: Make configurable.
|
||||
$limit = 50;
|
||||
$limit = $this->getLimit();
|
||||
|
||||
while (($records = $this->getRecords($offset, $limit)) !== []) {
|
||||
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 $limit
|
||||
|
|
Loading…
Reference in a new issue