From 7f62f09cf377b92b615e456ec4539300b331fd4b Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Sun, 27 Mar 2011 13:16:41 -0700 Subject: Improve search to use wildcard matching, thanks to some code from tempg. Fixes #1663. --- modules/search/controllers/search.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'modules/search/controllers') diff --git a/modules/search/controllers/search.php b/modules/search/controllers/search.php index eef009a0..75cbaa29 100644 --- a/modules/search/controllers/search.php +++ b/modules/search/controllers/search.php @@ -29,7 +29,8 @@ class Search_Controller extends Controller { $page = 1; } - list ($count, $result) = search::search($q, $page_size, $offset); + $q_with_more_terms = search::add_query_terms($q); + list ($count, $result) = search::search($q_with_more_terms, $page_size, $offset); $max_pages = max(ceil($count / $page_size), 1); -- cgit v1.2.3 From f10648fe0af7c2ae682290812cc78568aea23829 Mon Sep 17 00:00:00 2001 From: Joe7 Date: Sat, 2 Apr 2011 20:56:11 +0200 Subject: Sanitize page value before setting offset based on it --- modules/search/controllers/search.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'modules/search/controllers') diff --git a/modules/search/controllers/search.php b/modules/search/controllers/search.php index 75cbaa29..261d67ee 100644 --- a/modules/search/controllers/search.php +++ b/modules/search/controllers/search.php @@ -22,13 +22,14 @@ class Search_Controller extends Controller { $page_size = module::get_var("gallery", "page_size", 9); $q = Input::instance()->get("q"); $page = Input::instance()->get("page", 1); - $offset = ($page - 1) * $page_size; // Make sure that the page references a valid offset if ($page < 1) { $page = 1; } + $offset = ($page - 1) * $page_size; + $q_with_more_terms = search::add_query_terms($q); list ($count, $result) = search::search($q_with_more_terms, $page_size, $offset); -- cgit v1.2.3