function search_cron

Same name in other branches
  1. 7.x modules/search/search.module \search_cron()
  2. 9 core/modules/search/search.module \search_cron()
  3. 10 core/modules/search/search.module \search_cron()
  4. 11.x 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 177

Code

function search_cron() {
    
    /** @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();
    }
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.