You are here

search.install in Drupal 5

Same filename and directory in other branches
  1. 6 modules/search/search.install
  2. 7 modules/search/search.install

File

modules/search/search.install
View source
<?php

/**
 * Implementation of hook_install().
 */
function search_install() {
  switch ($GLOBALS['db_type']) {
    case 'mysql':
    case 'mysqli':
      db_query("CREATE TABLE {search_dataset} (\n        sid int unsigned NOT NULL default '0',\n        type varchar(16) default NULL,\n        data longtext NOT NULL,\n        KEY sid_type (sid, type)\n      ) /*!40100 DEFAULT CHARACTER SET UTF8 */ ");
      db_query("CREATE TABLE {search_index} (\n        word varchar(50) NOT NULL default '',\n        sid int unsigned NOT NULL default '0',\n        type varchar(16) default NULL,\n        fromsid int unsigned NOT NULL default '0',\n        fromtype varchar(16) default NULL,\n        score float default NULL,\n        KEY sid_type (sid, type),\n        KEY from_sid_type (fromsid, fromtype),\n        KEY word (word)\n      ) /*!40100 DEFAULT CHARACTER SET UTF8 */ ");
      db_query("CREATE TABLE {search_total} (\n        word varchar(50) NOT NULL default '',\n        count float default NULL,\n        PRIMARY KEY (word)\n      ) /*!40100 DEFAULT CHARACTER SET UTF8 */ ");
      break;
    case 'pgsql':
      db_query("CREATE TABLE {search_dataset} (\n        sid int_unsigned NOT NULL default '0',\n        type varchar(16) default NULL,\n        data text NOT NULL\n      )");
      db_query("CREATE INDEX {search_dataset}_sid_type_idx ON {search_dataset} (sid, type)");
      db_query("CREATE TABLE {search_index} (\n        word varchar(50) NOT NULL default '',\n        sid int_unsigned NOT NULL default '0',\n        type varchar(16) default NULL,\n        fromsid int_unsigned NOT NULL default '0',\n        fromtype varchar(16) default NULL,\n        score float default NULL\n      )");
      db_query("CREATE INDEX {search_index}_sid_type_idx ON {search_index} (sid, type)");
      db_query("CREATE INDEX {search_index}_from_sid_type_idx ON {search_index} (fromsid, fromtype)");
      db_query("CREATE INDEX {search_index}_word_idx ON {search_index} (word)");
      db_query("CREATE TABLE {search_total} (\n        word varchar(50) NOT NULL default '',\n        count float default NULL,\n        PRIMARY KEY (word)\n      )");
      break;
  }
}

/**
 * Implementation of hook_uninstall().
 */
function search_uninstall() {
  db_query('DROP TABLE {search_dataset}');
  db_query('DROP TABLE {search_index}');
  db_query('DROP TABLE {search_total}');
  variable_del('minimum_word_size');
  variable_del('overlap_cjk');
  variable_del('search_cron_limit');
}

Functions

Namesort descending Description
search_install Implementation of hook_install().
search_uninstall Implementation of hook_uninstall().