public function Basic::trackItemsUpdated in Search API 8
Marks the given items as updated for this index.
Parameters
string[] $ids: The item IDs of the updated items.
Overrides TrackerInterface::trackItemsUpdated
File
- src/
Plugin/ search_api/ tracker/ Basic.php, line 253
Class
- Basic
- Provides a tracker implementation which uses a FIFO-like processing order.
Namespace
Drupal\search_api\Plugin\search_api\trackerCode
public function trackItemsUpdated(array $ids = NULL) {
try {
// Process the IDs in chunks so we don't create an overly large UPDATE
// statement.
$ids_chunks = $ids !== NULL ? array_chunk($ids, 1000) : [
NULL,
];
foreach ($ids_chunks as $ids_chunk) {
$update = $this
->createUpdateStatement();
$update
->fields([
'changed' => $this
->getTimeService()
->getRequestTime(),
'status' => $this::STATUS_NOT_INDEXED,
]);
if ($ids_chunk) {
$update
->condition('item_id', $ids_chunk, 'IN');
}
// Update the status of unindexed items only if the item order is LIFO.
// (Otherwise, an item that's regularly being updated might never get
// indexed.)
if ($this->configuration['indexing_order'] === 'fifo') {
$update
->condition('status', self::STATUS_INDEXED);
}
$update
->execute();
}
} catch (\Exception $e) {
$this
->logException($e);
}
}