You are here

function search_by_page_reset_blank in Search by Page 6

Same name and namespace in other branches
  1. 8 search_by_page.module \search_by_page_reset_blank()
  2. 7 search_by_page.module \search_by_page_reset_blank()

Resets pages that have no words in search index, so they'll be reindexed.

Page callback for the 'admin/settings/search_by_page/resetblank' path.

1 string reference to 'search_by_page_reset_blank'
search_by_page_menu in ./search_by_page.module
Implementation of hook_menu().

File

./search_by_page.module, line 1354
Main module file for Drupal module Search by Page.

Code

function search_by_page_reset_blank() {

  // Query database to find pages in SBP with nothing in search index
  $zeros = db_query("SELECT sp.pid FROM {sbp_path} sp LEFT JOIN (SELECT * FROM {search_index} si WHERE si.type = 'search_by_page') sisp ON sisp.sid = sp.pid WHERE sisp.word IS NULL");
  $count = 0;
  while ($item = db_fetch_object($zeros)) {
    _search_by_page_update_last_time($item->pid);
    $count++;
  }
  drupal_set_message(t('Blank pages have been reset to index at next cron run (%num)', array(
    '%num' => $count,
  )));
  drupal_goto('admin/settings/search_by_page');
}