2006-07-13 13:14:25 +00:00
|
|
|
<?php
|
2006-07-14 01:05:10 +00:00
|
|
|
// $Id$
|
2006-07-13 13:14:25 +00:00
|
|
|
|
2006-09-01 07:40:08 +00:00
|
|
|
/**
|
|
|
|
* Implementation of hook_install().
|
|
|
|
*/
|
2006-07-13 13:14:25 +00:00
|
|
|
function search_install() {
|
2007-05-25 12:46:46 +00:00
|
|
|
// Create tables.
|
|
|
|
drupal_install_schema('search');
|
2006-08-04 06:58:44 +00:00
|
|
|
}
|
2006-09-01 07:40:08 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Implementation of hook_uninstall().
|
|
|
|
*/
|
|
|
|
function search_uninstall() {
|
2007-05-25 12:46:46 +00:00
|
|
|
// Remove tables.
|
|
|
|
drupal_uninstall_schema('search');
|
|
|
|
|
2006-09-01 07:40:08 +00:00
|
|
|
variable_del('minimum_word_size');
|
|
|
|
variable_del('overlap_cjk');
|
2007-09-29 08:08:59 +00:00
|
|
|
variable_del('search_cron_limit');
|
2006-09-01 07:40:08 +00:00
|
|
|
}
|
2007-10-05 14:43:26 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Implementation of hook_schema().
|
|
|
|
*/
|
|
|
|
function search_schema() {
|
|
|
|
$schema['search_dataset'] = array(
|
|
|
|
'fields' => array(
|
|
|
|
'sid' => array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0),
|
|
|
|
'type' => array('type' => 'varchar', 'length' => 16, 'not null' => FALSE),
|
|
|
|
'data' => array('type' => 'text', 'not null' => TRUE, 'size' => 'big')
|
|
|
|
),
|
|
|
|
'indexes' => array('sid_type' => array('sid', 'type')),
|
|
|
|
);
|
|
|
|
|
|
|
|
$schema['search_index'] = array(
|
|
|
|
'fields' => array(
|
|
|
|
'word' => array('type' => 'varchar', 'length' => 50, 'not null' => TRUE, 'default' => ''),
|
|
|
|
'sid' => array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0),
|
|
|
|
'type' => array('type' => 'varchar', 'length' => 16, 'not null' => FALSE),
|
|
|
|
'fromsid' => array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0),
|
|
|
|
'fromtype' => array('type' => 'varchar', 'length' => 16, 'not null' => FALSE),
|
|
|
|
'score' => array('type' => 'float', 'not null' => FALSE)
|
|
|
|
),
|
|
|
|
'indexes' => array(
|
|
|
|
'from_sid_type' => array('fromsid', 'fromtype'),
|
|
|
|
'sid_type' => array('sid', 'type'),
|
|
|
|
'word' => array('word')
|
|
|
|
),
|
|
|
|
);
|
|
|
|
|
|
|
|
$schema['search_total'] = array(
|
|
|
|
'fields' => array(
|
|
|
|
'word' => array('type' => 'varchar', 'length' => 50, 'not null' => TRUE, 'default' => ''),
|
|
|
|
'count' => array('type' => 'float', 'not null' => FALSE)
|
|
|
|
),
|
|
|
|
'primary key' => array('word'),
|
|
|
|
);
|
|
|
|
|
|
|
|
return $schema;
|
|
|
|
}
|
|
|
|
|