/[drupal]/drupal/modules/search/search.install
ViewVC logotype

Contents of /drupal/modules/search/search.install

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.26 - (show annotations) (download) (as text)
Tue Sep 29 15:13:56 2009 UTC (8 weeks, 2 days ago) by dries
Branch: MAIN
CVS Tags: DRUPAL-7-0-UNSTABLE-10, HEAD
Changes since 1.25: +6 -9 lines
File MIME type: text/x-php
- Patch #570900 by Crell | asimmonds: Changed Destroy remnants of update_sql().
1 <?php
2 // $Id: search.install,v 1.25 2009/09/27 00:12:14 dries Exp $
3
4 /**
5 * @file
6 * Install, update and uninstall functions for the search module.
7 */
8
9 /**
10 * Implement hook_uninstall().
11 */
12 function search_uninstall() {
13 variable_del('minimum_word_size');
14 variable_del('overlap_cjk');
15 variable_del('search_cron_limit');
16 }
17
18 /**
19 * Implement hook_schema().
20 */
21 function search_schema() {
22 $schema['search_dataset'] = array(
23 'description' => 'Stores items that will be searched.',
24 'fields' => array(
25 'sid' => array(
26 'type' => 'int',
27 'unsigned' => TRUE,
28 'not null' => TRUE,
29 'default' => 0,
30 'description' => 'Search item ID, e.g. node ID for nodes.',
31 ),
32 'type' => array(
33 'type' => 'varchar',
34 'length' => 16,
35 'not null' => FALSE,
36 'description' => 'Type of item, e.g. node.',
37 ),
38 'data' => array(
39 'type' => 'text',
40 'not null' => TRUE,
41 'size' => 'big',
42 'description' => 'List of space-separated words from the item.',
43 ),
44 'reindex' => array(
45 'type' => 'int',
46 'unsigned' => TRUE,
47 'not null' => TRUE,
48 'default' => 0,
49 'description' => 'Set to force node reindexing.',
50 ),
51 ),
52 'primary key' => array('sid', 'type'),
53 );
54
55 $schema['search_index'] = array(
56 'description' => 'Stores the search index, associating words, items and scores.',
57 'fields' => array(
58 'word' => array(
59 'type' => 'varchar',
60 'length' => 50,
61 'not null' => TRUE,
62 'default' => '',
63 'description' => 'The {search_total}.word that is associated with the search item.',
64 ),
65 'sid' => array(
66 'type' => 'int',
67 'unsigned' => TRUE,
68 'not null' => TRUE,
69 'default' => 0,
70 'description' => 'The {search_dataset}.sid of the searchable item to which the word belongs.',
71 ),
72 'type' => array(
73 'type' => 'varchar',
74 'length' => 16,
75 'not null' => FALSE,
76 'description' => 'The {search_dataset}.type of the searchable item to which the word belongs.',
77 ),
78 'score' => array(
79 'type' => 'float',
80 'not null' => FALSE,
81 'description' => 'The numeric score of the word, higher being more important.',
82 ),
83 ),
84 'indexes' => array(
85 'sid_type' => array('sid', 'type'),
86 ),
87 'foreign keys' => array(
88 'sid' => array('search_dataset' => 'sid'),
89 'type' => array('search_dataset' => 'type'),
90 ),
91 'primary key' => array('word', 'sid', 'type'),
92 );
93
94 $schema['search_total'] = array(
95 'description' => 'Stores search totals for words.',
96 'fields' => array(
97 'word' => array(
98 'description' => 'Primary Key: Unique word in the search index.',
99 'type' => 'varchar',
100 'length' => 50,
101 'not null' => TRUE,
102 'default' => '',
103 ),
104 'count' => array(
105 'description' => "The count of the word in the index using Zipf's law to equalize the probability distribution.",
106 'type' => 'float',
107 'not null' => FALSE,
108 ),
109 ),
110 'primary key' => array('word'),
111 );
112
113 $schema['search_node_links'] = array(
114 'description' => 'Stores items (like nodes) that link to other nodes, used to improve search scores for nodes that are frequently linked to.',
115 'fields' => array(
116 'sid' => array(
117 'type' => 'int',
118 'unsigned' => TRUE,
119 'not null' => TRUE,
120 'default' => 0,
121 'description' => 'The {search_dataset}.sid of the searchable item containing the link to the node.',
122 ),
123 'type' => array(
124 'type' => 'varchar',
125 'length' => 16,
126 'not null' => TRUE,
127 'default' => '',
128 'description' => 'The {search_dataset}.type of the searchable item containing the link to the node.',
129 ),
130 'nid' => array(
131 'type' => 'int',
132 'unsigned' => TRUE,
133 'not null' => TRUE,
134 'default' => 0,
135 'description' => 'The {node}.nid that this item links to.',
136 ),
137 'caption' => array(
138 'type' => 'text',
139 'size' => 'big',
140 'not null' => FALSE,
141 'description' => 'The text used to link to the {node}.nid.',
142 ),
143 ),
144 'primary key' => array('sid', 'type', 'nid'),
145 'indexes' => array(
146 'nid' => array('nid'),
147 ),
148 );
149
150 return $schema;
151 }
152
153 /**
154 * Replace unique keys in 'search_dataset' and 'search_index' by primary keys.
155 */
156 function search_update_7000() {
157 db_drop_unique_key('search_dataset', 'sid_type');
158 db_add_primary_key('search_dataset', array('sid', 'type'));
159
160 db_drop_index('search_index', 'word');
161 db_drop_unique_key('search_index', 'word_sid_type');
162 db_add_primary_key('search_index', array('word', 'sid', 'type'));
163 }

  ViewVC Help
Powered by ViewVC 1.1.2