[aur-dev] [PATCH 2/2] Add search for keywords only
Marcel Korpel
marcel.korpel at gmail.com
Fri Sep 18 21:12:14 UTC 2015
Implements FS#45619.
Signed-off-by: Marcel Korpel <marcel.korpel at gmail.com>
---
web/lib/pkgfuncs.inc.php | 7 +++++++
web/template/pkg_search_form.php | 1 +
2 files changed, 8 insertions(+)
diff --git a/web/lib/pkgfuncs.inc.php b/web/lib/pkgfuncs.inc.php
index d760429..da2c3da 100644
--- a/web/lib/pkgfuncs.inc.php
+++ b/web/lib/pkgfuncs.inc.php
@@ -608,6 +608,13 @@ function pkg_search_page($SID="") {
$K = "%" . addcslashes($_GET['K'], '%_') . "%";
$q_where .= "AND (PackageBases.Name LIKE " . $dbh->quote($K) . ") ";
}
+ elseif (isset($_GET["SeB"]) && $_GET["SeB"] == "k") {
+ /* Search by keywords. */
+ $K = "%" . addcslashes($_GET['K'], '%_') . "%";
+ $q_where .= "AND EXISTS (SELECT * FROM PackageKeywords WHERE ";
+ $q_where .= "PackageKeywords.PackageBaseID = Packages.PackageBaseID ";
+ $q_where .= "AND PackageKeywords.Keyword LIKE " . $dbh->quote($K) . ") ";
+ }
elseif (isset($_GET["SeB"]) && $_GET["SeB"] == "N") {
/* Search by name (exact match). */
$q_where .= "AND (Packages.Name = " . $dbh->quote($_GET['K']) . ") ";
diff --git a/web/template/pkg_search_form.php b/web/template/pkg_search_form.php
index 404d16e..cce3b6a 100644
--- a/web/template/pkg_search_form.php
+++ b/web/template/pkg_search_form.php
@@ -7,6 +7,7 @@ $searchby = array(
'b' => __('Package Base'),
'N' => __('Exact Name'),
'B' => __('Exact Package Base'),
+ 'k' => __('Keywords'),
'm' => __('Maintainer'),
's' => __('Submitter')
);
--
2.5.2
More information about the aur-dev
mailing list