protected function Basic::createRemainingItemsStatement in Search API 8
Creates a SELECT statement which filters on the not indexed items.
Parameters
string|null $datasource_id: (optional) If specified, only items of the datasource with that ID are retrieved.
Return value
\Drupal\Core\Database\Query\SelectInterface A SELECT statement.
2 calls to Basic::createRemainingItemsStatement()
- Basic::getRemainingItems in src/
Plugin/ search_api/ tracker/ Basic.php - Retrieves a list of item IDs that need to be indexed.
- Basic::getRemainingItemsCount in src/
Plugin/ search_api/ tracker/ Basic.php - Retrieves the total number of pending items for this index.
File
- src/
Plugin/ search_api/ tracker/ Basic.php, line 192
Class
- Basic
- Provides a tracker implementation which uses a FIFO-like processing order.
Namespace
Drupal\search_api\Plugin\search_api\trackerCode
protected function createRemainingItemsStatement($datasource_id = NULL) {
$select = $this
->createSelectStatement();
$select
->fields('sai', [
'item_id',
]);
if ($datasource_id) {
$select
->condition('datasource', $datasource_id);
}
$select
->condition('sai.status', $this::STATUS_NOT_INDEXED, '=');
// Use the same direction for both sorts to avoid performance problems.
$order = $this->configuration['indexing_order'] === 'lifo' ? 'DESC' : 'ASC';
$select
->orderBy('sai.changed', $order);
// Add a secondary sort on item ID to make the order completely predictable.
$select
->orderBy('sai.item_id', $order);
return $select;
}