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/search/helpers/search_event.php | 49 +++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 modules/search/helpers/search_event.php (limited to 'modules/search/helpers/search_event.php') diff --git a/modules/search/helpers/search_event.php b/modules/search/helpers/search_event.php new file mode 100644 index 00000000..a29d301b --- /dev/null +++ b/modules/search/helpers/search_event.php @@ -0,0 +1,49 @@ +item_id($item->id)->save(); + } + + static function item_updated($old_item, $new_item) { + Database::instance() + ->from("search_records") + ->set("dirty", 1) + ->where("item_id", $new_item->id) + ->update(); + } + + static function item_before_delete($item) { + ORM::factory("item_id", $item->id)->delete_all(); + } + + static function item_related_update($item) { + Database::instance() + ->from("search_records") + ->set("dirty", 1) + ->where("item_id", $item->id) + ->update(); + } + + static function item_related_update_batch($sql) { + $db = Database::instance(); + $db->query("UPDATE `search_records` SET `dirty` = 1 WHERE item_id IN ($sql)"); + } +} -- cgit v1.2.3