Mercurial > defr > drupal > core
comparison modules/search/search.install @ 1:c1f4ac30525a 6.0
Drupal 6.0
author | Franck Deroche <webmaster@defr.org> |
---|---|
date | Tue, 23 Dec 2008 14:28:28 +0100 |
parents | |
children | 3edae6ecd6c6 |
comparison
equal
deleted
inserted
replaced
0:5a113a1c4740 | 1:c1f4ac30525a |
---|---|
1 <?php | |
2 // $Id: search.install,v 1.14 2007/12/28 10:53:27 dries Exp $ | |
3 | |
4 /** | |
5 * Implementation of hook_install(). | |
6 */ | |
7 function search_install() { | |
8 // Create tables. | |
9 drupal_install_schema('search'); | |
10 } | |
11 | |
12 /** | |
13 * Implementation of hook_uninstall(). | |
14 */ | |
15 function search_uninstall() { | |
16 // Remove tables. | |
17 drupal_uninstall_schema('search'); | |
18 | |
19 variable_del('minimum_word_size'); | |
20 variable_del('overlap_cjk'); | |
21 variable_del('search_cron_limit'); | |
22 } | |
23 | |
24 /** | |
25 * Implementation of hook_schema(). | |
26 */ | |
27 function search_schema() { | |
28 $schema['search_dataset'] = array( | |
29 'description' => t('Stores items that will be searched.'), | |
30 'fields' => array( | |
31 'sid' => array( | |
32 'type' => 'int', | |
33 'unsigned' => TRUE, | |
34 'not null' => TRUE, | |
35 'default' => 0, | |
36 'description' => t('Search item ID, e.g. node ID for nodes.'), | |
37 ), | |
38 'type' => array( | |
39 'type' => 'varchar', | |
40 'length' => 16, | |
41 'not null' => FALSE, | |
42 'description' => t('Type of item, e.g. node.'), | |
43 ), | |
44 'data' => array( | |
45 'type' => 'text', | |
46 'not null' => TRUE, | |
47 'size' => 'big', | |
48 'description' => t('List of space-separated words from the item.'), | |
49 ), | |
50 'reindex' => array( | |
51 'type' => 'int', | |
52 'unsigned' => TRUE, | |
53 'not null' => TRUE, | |
54 'default' => 0, | |
55 'description' => t('Set to force node reindexing.'), | |
56 ), | |
57 ), | |
58 'unique keys' => array('sid_type' => array('sid', 'type')), | |
59 ); | |
60 | |
61 $schema['search_index'] = array( | |
62 'description' => t('Stores the search index, associating words, items and scores.'), | |
63 'fields' => array( | |
64 'word' => array( | |
65 'type' => 'varchar', | |
66 'length' => 50, | |
67 'not null' => TRUE, | |
68 'default' => '', | |
69 'description' => t('The {search_total}.word that is associated with the search item.'), | |
70 ), | |
71 'sid' => array( | |
72 'type' => 'int', | |
73 'unsigned' => TRUE, | |
74 'not null' => TRUE, | |
75 'default' => 0, | |
76 'description' => t('The {search_dataset}.sid of the searchable item to which the word belongs.'), | |
77 ), | |
78 'type' => array( | |
79 'type' => 'varchar', | |
80 'length' => 16, | |
81 'not null' => FALSE, | |
82 'description' => t('The {search_dataset}.type of the searchable item to which the word belongs.'), | |
83 ), | |
84 'score' => array( | |
85 'type' => 'float', | |
86 'not null' => FALSE, | |
87 'description' => t('The numeric score of the word, higher being more important.'), | |
88 ), | |
89 ), | |
90 'indexes' => array( | |
91 'sid_type' => array('sid', 'type'), | |
92 'word' => array('word') | |
93 ), | |
94 'unique keys' => array('word_sid_type' => array('word', 'sid', 'type')), | |
95 ); | |
96 | |
97 $schema['search_total'] = array( | |
98 'description' => t('Stores search totals for words.'), | |
99 'fields' => array( | |
100 'word' => array( | |
101 'description' => t('Primary Key: Unique word in the search index.'), | |
102 'type' => 'varchar', | |
103 'length' => 50, | |
104 'not null' => TRUE, | |
105 'default' => '', | |
106 ), | |
107 'count' => array( | |
108 'description' => t("The count of the word in the index using Zipf's law to equalize the probability distribution."), | |
109 'type' => 'float', | |
110 'not null' => FALSE, | |
111 ), | |
112 ), | |
113 'primary key' => array('word'), | |
114 ); | |
115 | |
116 $schema['search_node_links'] = array( | |
117 'description' => t('Stores items (like nodes) that link to other nodes, used to improve search scores for nodes that are frequently linked to.'), | |
118 'fields' => array( | |
119 'sid' => array( | |
120 'type' => 'int', | |
121 'unsigned' => TRUE, | |
122 'not null' => TRUE, | |
123 'default' => 0, | |
124 'description' => t('The {search_dataset}.sid of the searchable item containing the link to the node.'), | |
125 ), | |
126 'type' => array( | |
127 'type' => 'varchar', | |
128 'length' => 16, | |
129 'not null' => TRUE, | |
130 'default' => '', | |
131 'description' => t('The {search_dataset}.type of the searchable item containing the link to the node.'), | |
132 ), | |
133 'nid' => array( | |
134 'type' => 'int', | |
135 'unsigned' => TRUE, | |
136 'not null' => TRUE, | |
137 'default' => 0, | |
138 'description' => t('The {node}.nid that this item links to.'), | |
139 ), | |
140 'caption' => array( | |
141 'type' => 'text', | |
142 'size' => 'big', | |
143 'not null' => FALSE, | |
144 'description' => t('The text used to link to the {node}.nid.'), | |
145 ), | |
146 ), | |
147 'primary key' => array('sid', 'type', 'nid'), | |
148 'indexes' => array('nid' => array('nid')), | |
149 ); | |
150 | |
151 return $schema; | |
152 } | |
153 |