You are here

function fuzzysearch_admin_form_submit in Fuzzy Search 6

1 string reference to 'fuzzysearch_admin_form_submit'
fuzzysearch_admin_form in ./fuzzysearch.admin.inc
Module Administration (clear index).

File

./fuzzysearch.admin.inc, line 214
Admin settings and related functions

Code

function fuzzysearch_admin_form_submit($form, &$form_state) {
  if ($form_state['values']['fuzzysearch_reindex'] || $form_state['values']['fuzzysearch_clear_index']) {

    // Refresh the index queue.
    db_query("TRUNCATE {fuzzysearch_index_queue}");

    // Empty the index.
    if ($form_state['values']['fuzzysearch_clear_index']) {
      db_query("TRUNCATE {fuzzysearch_index}");
      drupal_set_message(t('Fuzzy Search indexed cleared.'));
    }
    $query = db_query("SELECT nid FROM {node}");
    while ($row = db_fetch_object($query)) {
      fuzzysearch_reindex($row->nid, 'fuzzysearch');
    }
    drupal_set_message(t('Nodes ready for reindexing, please run cron to update the index.'));
  }

  // Rebuild the menu in case the results path changes.
  if ($form_state['values']['fuzzysearch_path_name'] != variable_get('fuzzysearch_path_name', 'fuzzysearch/results')) {
    module_invoke('menu', 'rebuild');
  }
}