function hook_search_api_items_indexed in Search API 8
Same name and namespace in other branches
- 7 search_api.api.php \hook_search_api_items_indexed()
React after items were indexed.
Parameters
\Drupal\search_api\IndexInterface $index: The used index.
array $item_ids: An array containing the successfully indexed items' IDs.
Deprecated
in search_api:8.x-1.14 and is removed from search_api:2.0.0. Please use the "search_api.items_indexed" event instead.
See also
https://www.drupal.org/node/3059866
1 function implements hook_search_api_items_indexed()
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_items_indexed in tests/
search_api_test_hooks/ search_api_test_hooks.search_api.inc - Implements hook_search_api_items_indexed().
File
- ./
search_api.api.php, line 312 - Hooks provided by the Search API module.
Code
function hook_search_api_items_indexed(\Drupal\search_api\IndexInterface $index, array $item_ids) {
if ($index
->isValidDatasource('entity:node')) {
// Note that this is just an example, and would only work if there are only
// nodes indexed in that index (and even then the printed IDs would probably
// not be as expected).
$message = t('Nodes indexed: @ids.', implode(', ', $item_ids));
\Drupal::messenger()
->addStatus($message);
}
}