You are here

public function Basic::trackItemsIndexed in Search API 8

Marks items as indexed for this index.

Parameters

string[] $ids: An array of item IDs.

Overrides TrackerInterface::trackItemsIndexed

File

src/Plugin/search_api/tracker/Basic.php, line 304

Class

Basic
Provides a tracker implementation which uses a FIFO-like processing order.

Namespace

Drupal\search_api\Plugin\search_api\tracker

Code

public function trackItemsIndexed(array $ids) {
  try {

    // Process the IDs in chunks so we don't create an overly large UPDATE
    // statement.
    $ids_chunks = array_chunk($ids, 1000);
    foreach ($ids_chunks as $ids_chunk) {
      $update = $this
        ->createUpdateStatement();
      $update
        ->fields([
        'status' => $this::STATUS_INDEXED,
      ]);
      $update
        ->condition('item_id', $ids_chunk, 'IN');
      $update
        ->execute();
    }
  } catch (\Exception $e) {
    $this
      ->logException($e);
  }
}