function search_cron

search_cron()

Implements hook_cron().

Fires updateIndex() in the plugins for all indexable active search pages, and cleans up dirty words.

See also

search_dirty()

File

core/modules/search/search.module, line 187
Enables site-wide keyword searching.

Code

function search_cron() {
  // We register a shutdown function to ensure that search_total is always up
  // to date.
  drupal_register_shutdown_function('search_update_totals');

  /** @var $search_page_repository \Drupal\search\SearchPageRepositoryInterface */
  $search_page_repository = \Drupal::service('search.search_page_repository');
  foreach ($search_page_repository->getIndexableSearchPages() as $entity) {
    $entity->getPlugin()->updateIndex();
  }
}

© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/core!modules!search!search.module/function/search_cron/8.1.x