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/controllers/search.php | 43 +++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 modules/search/controllers/search.php (limited to 'modules/search/controllers') diff --git a/modules/search/controllers/search.php b/modules/search/controllers/search.php new file mode 100644 index 00000000..f7313259 --- /dev/null +++ b/modules/search/controllers/search.php @@ -0,0 +1,43 @@ +input->get("q"); + $page = $this->input->get("page", 1); + $offset = ($page - 1) * $page_size; + + // Make sure that the page references a valid offset + if ($page < 1) { + $page = 1; + } + + list ($count, $result) = search::search($q, $page_size, $offset); + $template = new Theme_View("page.html", "search"); + $template->set_global("page_size", $page_size); + $template->set_global("children_count", $count); + + $template->content = new View("search.html"); + $template->content->items = $result; + $template->content->q = $q; + + print $template; + } +} -- cgit v1.2.3