diff options
| author | Bharat Mediratta <bharat@menalto.com> | 2009-01-17 00:52:50 +0000 |
|---|---|---|
| committer | Bharat Mediratta <bharat@menalto.com> | 2009-01-17 00:52:50 +0000 |
| commit | d568a1e9fd63c97eb86cd84a51bb6770747ec37c (patch) | |
| tree | 2b382bce985bce886c69d6d58377c5ce71a0cdc6 /modules/search/helpers/search_installer.php | |
| parent | 91be7a38f883cd008d370f81ff68949de68eafbf (diff) | |
Implement relevance ranked boolean searching on a full text index of
item and comment data. Whew!
It's not pretty yet. And you have to manually update the index
currently in admin/maintenance. But it works.
Diffstat (limited to 'modules/search/helpers/search_installer.php')
| -rw-r--r-- | modules/search/helpers/search_installer.php | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/modules/search/helpers/search_installer.php b/modules/search/helpers/search_installer.php index 7dc4c39a..ae8eacd3 100644 --- a/modules/search/helpers/search_installer.php +++ b/modules/search/helpers/search_installer.php @@ -20,12 +20,29 @@ class search_installer { static function install() { $version = module::get_version("search"); + $db = Database::instance(); if ($version == 0) { + $db->query("CREATE TABLE `search_records` ( + `id` int(9) NOT NULL auto_increment, + `item_id` int(9), + `dirty` boolean default 1, + `data` LONGTEXT default NULL, + PRIMARY KEY (`id`), + FULLTEXT INDEX (`data`)) + ENGINE=MyISAM DEFAULT CHARSET=utf8;"); + + // populate the index with dirty records + $db->query("insert into `search_records` (`item_id`) SELECT `id` FROM `items`"); module::set_version("search", 1); + + search::check_index(); } } static function uninstall() { + $db = Database::instance(); + $db->query("DROP TABLE `search_records`"); + site_status::clear("search_index_out_of_date"); module::delete("search"); } } |
