You are here

function hook_search_api_index_reindex in Search API 8

Same name and namespace in other branches
  1. 7 search_api.api.php \hook_search_api_index_reindex()

React when a search index was scheduled for reindexing.

Parameters

\Drupal\search_api\IndexInterface $index: The index scheduled for reindexing.

bool $clear: Boolean indicating whether the index was also cleared.

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 also

https://www.drupal.org/node/3059866

1 function implements hook_search_api_index_reindex()

Note: this list is generated by pattern matching, so it may include some functions that are not actually implementations of this hook.

search_api_test_hooks_search_api_index_reindex in tests/search_api_test_hooks/search_api_test_hooks.search_api.inc
Implements hook_search_api_index_reindex().

File

./search_api.api.php, line 425
Hooks provided by the Search API module.

Code

function hook_search_api_index_reindex(\Drupal\search_api\IndexInterface $index, $clear = FALSE) {
  \Drupal\Core\Database\Database::getConnection()
    ->insert('example_search_index_reindexed')
    ->fields([
    'index' => $index
      ->id(),
    'clear' => $clear,
    'update_time' => \Drupal::time()
      ->getRequestTime(),
  ])
    ->execute();
}