Code coverage for /20081101/modules/search/search.install

Line #Times calledCode
1
<?php
2
// $Id: search.install,v 1.15 2008/03/15 12:31:29 dries Exp $
3
4
/**
5
 * Implementation of hook_install().
6
 */
74
function search_install() {
8
  // Create tables.
94
  drupal_install_schema('search');
104
}
11
12
/**
13
 * Implementation of hook_uninstall().
14
 */
154
function search_uninstall() {
16
  // Remove tables.
170
  drupal_uninstall_schema('search');
18
190
  variable_del('minimum_word_size');
200
  variable_del('overlap_cjk');
210
  variable_del('search_cron_limit');
220
}
23
24
/**
25
 * Implementation of hook_schema().
26
 */
274
function search_schema() {
284
  $schema['search_dataset'] = array(
294
    'description' => t('Stores items that will be searched.'),
30
    'fields' => array(
31
      'sid' => array(
324
        'type' => 'int',
334
        'unsigned' => TRUE,
344
        'not null' => TRUE,
354
        'default' => 0,
364
        'description' => t('Search item ID, e.g. node ID for nodes.'),
374
      ),
38
      'type' => array(
394
        'type' => 'varchar',
404
        'length' => 16,
414
        'not null' => FALSE,
424
        'description' => t('Type of item, e.g. node.'),
434
      ),
44
      'data' => array(
454
        'type' => 'text',
464
        'not null' => TRUE,
474
        'size' => 'big',
484
        'description' => t('List of space-separated words from the item.'),
494
      ),
50
      'reindex' => array(
514
        'type' => 'int',
524
        'unsigned' => TRUE,
534
        'not null' => TRUE,
544
        'default' => 0,
554
        'description' => t('Set to force node reindexing.'),
564
      ),
574
    ),
58
    'unique keys' => array(
594
      'sid_type' => array('sid', 'type'),
604
    ),
61
  );
62
634
  $schema['search_index'] = array(
644
    'description' => t('Stores the search index, associating words, items
and scores.'),
65
    'fields' => array(
66
      'word' => array(
674
        'type' => 'varchar',
684
        'length' => 50,
694
        'not null' => TRUE,
704
        'default' => '',
714
        'description' => t('The {search_total}.word that is associated with
the search item.'),
724
      ),
73
      'sid' => array(
744
        'type' => 'int',
754
        'unsigned' => TRUE,
764
        'not null' => TRUE,
774
        'default' => 0,
784
        'description' => t('The {search_dataset}.sid of the searchable item
to which the word belongs.'),
794
      ),
80
      'type' => array(
814
        'type' => 'varchar',
824
        'length' => 16,
834
        'not null' => FALSE,
844
        'description' => t('The {search_dataset}.type of the searchable
item to which the word belongs.'),
854
      ),
86
      'score' => array(
874
        'type' => 'float',
884
        'not null' => FALSE,
894
        'description' => t('The numeric score of the word, higher being
more important.'),
904
      ),
914
    ),
92
    'indexes' => array(
934
      'sid_type' => array('sid', 'type'),
944
      'word' => array('word'),
954
    ),
96
    'unique keys' => array(
974
      'word_sid_type' => array('word', 'sid', 'type'),
984
    ),
99
  );
100
1014
  $schema['search_total'] = array(
1024
    'description' => t('Stores search totals for words.'),
103
    'fields' => array(
104
      'word' => array(
1054
        'description' => t('Primary Key: Unique word in the search
index.'),
1064
        'type' => 'varchar',
1074
        'length' => 50,
1084
        'not null' => TRUE,
1094
        'default' => '',
1104
      ),
111
      'count' => array(
1124
        'description' => t("The count of the word in the index using Zipf's
law to equalize the probability distribution."),
1134
        'type' => 'float',
1144
        'not null' => FALSE,
1154
      ),
1164
    ),
1174
    'primary key' => array('word'),
118
  );
119
1204
  $schema['search_node_links'] = array(
1214
    'description' => t('Stores items (like nodes) that link to other nodes,
used to improve search scores for nodes that are frequently linked to.'),
122
    'fields' => array(
123
      'sid' => array(
1244
        'type' => 'int',
1254
        'unsigned' => TRUE,
1264
        'not null' => TRUE,
1274
        'default' => 0,
1284
        'description' => t('The {search_dataset}.sid of the searchable item
containing the link to the node.'),
1294
      ),
130
      'type' => array(
1314
        'type' => 'varchar',
1324
        'length' => 16,
1334
        'not null' => TRUE,
1344
        'default' => '',
1354
        'description' => t('The {search_dataset}.type of the searchable
item containing the link to the node.'),
1364
      ),
137
      'nid' => array(
1384
        'type' => 'int',
1394
        'unsigned' => TRUE,
1404
        'not null' => TRUE,
1414
        'default' => 0,
1424
        'description' => t('The {node}.nid that this item links to.'),
1434
      ),
144
      'caption' => array(
1454
        'type' => 'text',
1464
        'size' => 'big',
1474
        'not null' => FALSE,
1484
        'description' => t('The text used to link to the {node}.nid.'),
1494
      ),
1504
    ),
1514
    'primary key' => array('sid', 'type', 'nid'),
152
    'indexes' => array(
1534
      'nid' => array('nid'),
1544
    ),
155
  );
156
1574
  return $schema;
1580
}
1594