public function SearchApiAbstractDataSourceController::getChangedItems in Search API 7
Retrieves a list of items that need to be indexed.
If possible, completely unindexed items should be returned before items that were indexed but later changed. Also, items that were changed longer ago should be favored.
Parameters
SearchApiIndex $index: The index for which changed items should be returned.
int $limit: The maximum number of items to return. Negative values mean "unlimited".
Return value
array The IDs of items that need to be indexed for the given index.
Throws
SearchApiDataSourceException If any error state was encountered.
Overrides SearchApiDataSourceControllerInterface::getChangedItems
1 method overrides SearchApiAbstractDataSourceController::getChangedItems()
- SearchApiExternalDataSourceController::getChangedItems in includes/
datasource_external.inc - Get a list of items that need to be indexed.
File
- includes/
datasource.inc, line 792 - Contains the SearchApiDataSourceControllerInterface as well as a default base class.
Class
- SearchApiAbstractDataSourceController
- Provides a default base class for datasource controllers.
Code
public function getChangedItems(SearchApiIndex $index, $limit = -1) {
if ($limit == 0) {
return array();
}
$this
->checkIndex($index);
$select = db_select($this->table, 't');
$select
->addField('t', $this->itemIdColumn);
$select
->condition($this->indexIdColumn, $index->id);
$select
->condition($this->changedColumn, 0, '>');
$select
->orderBy($this->changedColumn, 'ASC');
if ($limit > 0) {
$select
->range(0, $limit);
}
return $select
->execute()
->fetchCol();
}