From d568a1e9fd63c97eb86cd84a51bb6770747ec37c Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Sat, 17 Jan 2009 00:52:50 +0000 Subject: 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. --- modules/comment/helpers/comment_installer.php | 3 +++ modules/comment/helpers/comment_search.php | 34 +++++++++++++++++++++++++++ 2 files changed, 37 insertions(+) create mode 100644 modules/comment/helpers/comment_search.php (limited to 'modules/comment/helpers') diff --git a/modules/comment/helpers/comment_installer.php b/modules/comment/helpers/comment_installer.php index aba32566..651065f7 100644 --- a/modules/comment/helpers/comment_installer.php +++ b/modules/comment/helpers/comment_installer.php @@ -58,6 +58,9 @@ class comment_installer { static function uninstall() { $db = Database::instance(); + $sql = "SELECT `item_id` FROM `comments`"; + module::event("item_related_update_batch", $sql); + $db->query("DROP TABLE IF EXISTS `comments`;"); module::delete("comment"); } diff --git a/modules/comment/helpers/comment_search.php b/modules/comment/helpers/comment_search.php new file mode 100644 index 00000000..79a0c4bc --- /dev/null +++ b/modules/comment/helpers/comment_search.php @@ -0,0 +1,34 @@ +select("text") + ->from("comments") + ->where("item_id", $item->id) + ->get() + ->as_array() as $row) { + $data[] = $row->text; + } + return join(" ", $data); + } +} -- cgit v1.2.3