1 search.module | search_reindex_batch($passes_needed, $search_active_modules, &$context) |
Batch operation to rebuild the search index.
See also
search_reindex_confirm_submit()
File
- core/
modules/ search/ search.module, line 1468 - Enables site-wide keyword searching.
Code
function search_reindex_batch($passes_needed, $search_active_modules, &$context) {
if (!isset($context['sandbox']['current_pass'])) {
$context['sandbox']['current_pass'] = 0;
}
// Invoke hook_update_index for all search active modules.
if ($context['sandbox']['current_pass'] < $passes_needed) {
// Register a shutdown function to ensure that search_total is up-to-date.
backdrop_register_shutdown_function('search_update_totals');
foreach ($search_active_modules as $module) {
module_invoke($module, 'update_index');
}
$context['sandbox']['current_pass']++;
$context['message'] = t('Now processing pass %pass of %needed', array('%pass' => $context['sandbox']['current_pass'], '%needed' => $passes_needed));
$context['finished'] = $context['sandbox']['current_pass'] / $passes_needed;
}
}