You are here

function fuzzysearch_install in Fuzzy Search 6

Same name and namespace in other branches
  1. 7 fuzzysearch.install \fuzzysearch_install()

File

./fuzzysearch.install, line 88
Install file for fuzzysearch module.

Code

function fuzzysearch_install() {

  // Create tables.
  drupal_install_schema('fuzzysearch');
  variable_set('fuzzysearch_ngram_length', 3);
  variable_set('fuzzysearch_completeness', 40);

  // Queue all content for indexing.
  $query = db_query("SELECT nid FROM {node}");
  while ($row = db_fetch_object($query)) {
    $queue = db_query("SELECT * FROM {fuzzysearch_index_queue} WHERE nid = %d", $row->nid);
    if (!db_result($queue)) {
      db_query("INSERT INTO {fuzzysearch_index_queue} (nid, module, timestamp) VALUES (%d, '%s', %d)", $row->nid, $module, time());
    }
  }
  drupal_set_message(st('Fuzzysearch module installed successfully.'));
  drupal_set_message(st('Content queued for indexing, please run cron to begin indexing.'));
}