public function Index::reindex in Search API 8
Marks all items in this index for reindexing.
Throws
\Drupal\search_api\SearchApiException Thrown if an internal error prevented the operation from succeeding – for example, if the tracker couldn't be loaded.
Overrides IndexInterface::reindex
2 calls to Index::reindex()
- Index::reactToProcessorChanges in src/
Entity/ Index.php - Reacts to changes in processor configuration.
- Index::reactToServerSwitch in src/
Entity/ Index.php - Checks whether the index switched server and reacts accordingly.
File
- src/
Entity/ Index.php, line 1120
Class
- Index
- Defines the search index configuration entity.
Namespace
Drupal\search_api\EntityCode
public function reindex() {
if ($this
->status() && !$this
->isReindexing()) {
$this
->setHasReindexed();
$this
->getTrackerInstance()
->trackAllItemsUpdated();
$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));
}
}