You are here

public function CommandHelper::rebuildTrackerCommand in Search API 8

Rebuilds the tracker for an index.

Parameters

string[]|null $indexIds: (optional) An array of index IDs, or NULL if we should reset the trackers of all indexes.

Return value

bool TRUE if any index was affected, FALSE otherwise.

File

src/Utility/CommandHelper.php, line 408

Class

CommandHelper
Provides functionality to be used by CLI tools.

Namespace

Drupal\search_api\Utility

Code

public function rebuildTrackerCommand(array $indexIds = NULL) {
  $indexes = $this
    ->loadIndexes($indexIds);
  if (!$indexes) {
    return FALSE;
  }
  foreach ($indexes as $index) {
    if ($index
      ->status()) {
      $index
        ->rebuildTracker();
      $this->logger
        ->info($this
        ->t('The tracking information for search index %name will be rebuilt.', [
        '%name' => $index
          ->label(),
      ]));
    }
  }
  return TRUE;
}