Code coverage for /20080809/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
 */
73
function search_install() {
8
  // Create tables.
93
  drupal_install_schema('search');
103
}
11
12
/**
13
 * Implementation of hook_uninstall().
14
 */
153
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
 */
273
function search_schema() {
283
  $schema['search_dataset'] = array(
293
    'description' => t('Stores items that will be searched.'),
30
    'fields' => array(
31
      'sid' => array(
323
        'type' => 'int',
333
        'unsigned' => TRUE,
343
        'not null' => TRUE,
353
        'default' => 0,
363
        'description' => t('Search item ID, e.g. node ID for nodes.'),
373
      ),
38
      'type' => array(
393
        'type' => 'varchar',
403
        'length' => 16,
413
        'not null' => FALSE,
423
        'description' => t('Type of item, e.g. node.'),
433
      ),
44
      'data' => array(
453
        'type' => 'text',
463
        'not null' => TRUE,
473
        'size' => 'big',
483
        'description' => t('List of space-separated words from the
item.'),
493
      ),
50
      'reindex' => array(
513
        'type' => 'int',
523
        'unsigned' => TRUE,
533
        'not null' => TRUE,
543
        'default' => 0,
553
        'description' => t('Set to force node reindexing.'),
563
      ),
573
    ),
58
    'unique keys' => array(
593
      'sid_type' => array('sid', 'type'),
603
    ),
61
  );
62
633
  $schema['search_index'] = array(
643
    'description' => t('Stores the search index, associating words, items
and scores.'),
65
    'fields' => array(
66
      'word' => array(
673
        'type' => 'varchar',
683
        'length' => 50,
693
        'not null' => TRUE,
703
        'default' => '',
713
        'description' => t('The {search_total}.word that is associated with
the search item.'),
723
      ),
73
      'sid' => array(
743
        'type' => 'int',
753
        'unsigned' => TRUE,
763
        'not null' => TRUE,
773
        'default' => 0,
783
        'description' => t('The {search_dataset}.sid of the searchable item
to which the word belongs.'),
793
      ),
80
      'type' => array(
813
        'type' => 'varchar',
823
        'length' => 16,
833
        'not null' => FALSE,
843
        'description' => t('The {search_dataset}.type of the searchable
item to which the word belongs.'),
853
      ),
86
      'score' => array(
873
        'type' => 'float',
883
        'not null' => FALSE,
893
        'description' => t('The numeric score of the word, higher being
more important.'),
903
      ),
913
    ),
92
    'indexes' => array(
933
      'sid_type' => array('sid', 'type'),
943
      'word' => array('word'),
953
    ),
96
    'unique keys' => array(
973
      'word_sid_type' => array('word', 'sid', 'type'),
983
    ),
99
  );
100
1013
  $schema['search_total'] = array(
1023
    'description' => t('Stores search totals for words.'),
103
    'fields' => array(
104
      'word' => array(
1053
        'description' => t('Primary Key: Unique word in the search
index.'),
1063
        'type' => 'varchar',
1073
        'length' => 50,
1083
        'not null' => TRUE,
1093
        'default' => '',
1103
      ),
111
      'count' => array(
1123
        'description' => t("The count of the word in the index using Zipf's
law to equalize the probability distribution."),
1133
        'type' => 'float',
1143
        'not null' => FALSE,
1153
      ),
1163
    ),
1173
    'primary key' => array('word'),
118
  );
119
1203
  $schema['search_node_links'] = array(
1213
    '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(
1243
        'type' => 'int',
1253
        'unsigned' => TRUE,
1263
        'not null' => TRUE,
1273
        'default' => 0,
1283
        'description' => t('The {search_dataset}.sid of the searchable item
containing the link to the node.'),
1293
      ),
130
      'type' => array(
1313
        'type' => 'varchar',
1323
        'length' => 16,
1333
        'not null' => TRUE,
1343
        'default' => '',
1353
        'description' => t('The {search_dataset}.type of the searchable
item containing the link to the node.'),
1363
      ),
137
      'nid' => array(
1383
        'type' => 'int',
1393
        'unsigned' => TRUE,
1403
        'not null' => TRUE,
1413
        'default' => 0,
1423
        'description' => t('The {node}.nid that this item links to.'),
1433
      ),
144
      'caption' => array(
1453
        'type' => 'text',
1463
        'size' => 'big',
1473
        'not null' => FALSE,
1483
        'description' => t('The text used to link to the {node}.nid.'),
1493
      ),
1503
    ),
1513
    'primary key' => array('sid', 'type', 'nid'),
152
    'indexes' => array(
1533
      'nid' => array('nid'),
1543
    ),
155
  );
156
1573
  return $schema;
1580
}
1593