[aur-dev] [PATCH] Use keyword search by default

Lukas Fleischer lfleischer at archlinux.org
Fri May 22 10:06:52 UTC 2015


Signed-off-by: Lukas Fleischer <lfleischer at archlinux.org>
---
 web/lib/pkgfuncs.inc.php | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/web/lib/pkgfuncs.inc.php b/web/lib/pkgfuncs.inc.php
index c71358a..8fd629f 100644
--- a/web/lib/pkgfuncs.inc.php
+++ b/web/lib/pkgfuncs.inc.php
@@ -601,9 +601,11 @@ function pkg_search_page($SID="") {
 		}
 		else {
 			/* Search by name and description (default). */
-			$K = "%" . addcslashes($_GET['K'], '%_') . "%";
-			$q_where .= "AND (Packages.Name LIKE " . $dbh->quote($K) . " OR ";
-			$q_where .= "Description LIKE " . $dbh->quote($K) . ") ";
+			foreach (str_getcsv($_GET['K'], ' ') as $term) {
+				$term = "%" . addcslashes($term, '%_') . "%";
+				$q_where .= "AND (Packages.Name LIKE " . $dbh->quote($term) . " OR ";
+				$q_where .= "Description LIKE " . $dbh->quote($term) . ") ";
+			}
 		}
 	}
 
-- 
2.4.1


More information about the aur-dev mailing list