Same name and namespace in other branches
  1. 4.6.x modules/search.module \search_cron()
  2. 4.7.x modules/search.module \search_cron()
  3. 5.x modules/search/search.module \search_cron()
  4. 6.x modules/search/search.module \search_cron()
  5. 7.x modules/search/search.module \search_cron()
  6. 8.9.x core/modules/search/search.module \search_cron()
  7. 9 core/modules/search/search.module \search_cron()

Implements hook_cron().

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

File

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

Code

function search_cron() {

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