You are here

public function Basic::trackAllItemsUpdated in Search API 8

Marks all items as updated, or only those of a specific datasource.

Parameters

string|null $datasource_id: (optional) If given, only items of that datasource are marked as updated.

Overrides TrackerInterface::trackAllItemsUpdated

File

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

Class

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

Namespace

Drupal\search_api\Plugin\search_api\tracker

Code

public function trackAllItemsUpdated($datasource_id = NULL) {
  try {
    $update = $this
      ->createUpdateStatement();
    $update
      ->fields([
      'changed' => $this
        ->getTimeService()
        ->getRequestTime(),
      'status' => $this::STATUS_NOT_INDEXED,
    ]);
    if ($datasource_id) {
      $update
        ->condition('datasource', $datasource_id);
    }
    $update
      ->execute();
  } catch (\Exception $e) {
    $this
      ->logException($e);
  }
}