public function Basic::trackItemsDeleted in Search API 8
Removes items from the tracking system for this index.
Parameters
string[]|null $ids: (optional) The item IDs of the deleted items; or NULL to remove all items.
Overrides TrackerInterface::trackItemsDeleted
File
- src/
Plugin/ search_api/ tracker/ Basic.php, line 324
Class
- Basic
- Provides a tracker implementation which uses a FIFO-like processing order.
Namespace
Drupal\search_api\Plugin\search_api\trackerCode
public function trackItemsDeleted(array $ids = NULL) {
try {
// Process the IDs in chunks so we don't create an overly large DELETE
// statement.
$ids_chunks = $ids !== NULL ? array_chunk($ids, 1000) : [
NULL,
];
foreach ($ids_chunks as $ids_chunk) {
$delete = $this
->createDeleteStatement();
if ($ids_chunk) {
$delete
->condition('item_id', $ids_chunk, 'IN');
}
$delete
->execute();
}
} catch (\Exception $e) {
$this
->logException($e);
}
}