public function Index::rebuildTracker in Search API 8
Starts a rebuild of the index's tracking information.
Overrides IndexInterface::rebuildTracker
See also
\Drupal\search_api\Task\IndexTaskManagerInterface::stopTracking()
\Drupal\search_api\Task\IndexTaskManagerInterface::startTracking()
File
- src/
Entity/ Index.php, line 1164
Class
- Index
- Defines the search index configuration entity.
Namespace
Drupal\search_api\EntityCode
public function rebuildTracker() {
if (!$this
->status()) {
return;
}
$index_task_manager = \Drupal::getContainer()
->get('search_api.index_task_manager');
$index_task_manager
->stopTracking($this);
$index_task_manager
->startTracking($this);
$this
->setHasReindexed();
$description = 'This hook is deprecated in search_api:8.x-1.14 and is removed from search_api:2.0.0. Please use the "search_api.reindex_scheduled" event instead. See https://www.drupal.org/node/3059866';
\Drupal::moduleHandler()
->invokeAllDeprecated($description, 'search_api_index_reindex', [
$this,
FALSE,
]);
/** @var \Symfony\Component\EventDispatcher\EventDispatcherInterface $dispatcher */
$dispatcher = \Drupal::getContainer()
->get('event_dispatcher');
$dispatcher
->dispatch(SearchApiEvents::REINDEX_SCHEDULED, new ReindexScheduledEvent($this, FALSE));
$index_task_manager
->addItemsBatch($this);
}