[aur-dev] [PATCH 1/1] Fix for issue FS#49134 - AUR site search includes packages' keywords when searching by name and description
--- web/lib/pkgfuncs.inc.php | 5 +++++ 1 files changed, 5 insertions(+), 0 deletions(-) diff --git a/web/lib/pkgfuncs.inc.php b/web/lib/pkgfuncs.inc.php index 4b0fdba..f61e52c 100644 --- a/web/lib/pkgfuncs.inc.php +++ b/web/lib/pkgfuncs.inc.php @@ -755,6 +755,11 @@ function pkg_search_page($SID="") { $K = "%" . addcslashes($_GET['K'], '%_') . "%"; $q_where .= "AND (Packages.Name LIKE " . $dbh->quote($K) . ") "; } + elseif (isset($_GET["SeB"]) && $_GET["SeB"] == "nd") { + /* Search by name. */ + $K = "%" . addcslashes($_GET['K'], '%_') . "%"; + $q_where .= "AND (Packages.Name LIKE " . $dbh->quote($K) . " OR Packages.Description LIKE " . $dbh->quote($K) . ") "; + } elseif (isset($_GET["SeB"]) && $_GET["SeB"] == "b") { /* Search by package base name. */ $K = "%" . addcslashes($_GET['K'], '%_') . "%"; -- 1.7.3.4
On Fri, 23 Dec 2016 at 23:14:57, Nodiv Byzero via aur-dev wrote:
--- web/lib/pkgfuncs.inc.php | 5 +++++ 1 files changed, 5 insertions(+), 0 deletions(-)
diff --git a/web/lib/pkgfuncs.inc.php b/web/lib/pkgfuncs.inc.php index 4b0fdba..f61e52c 100644 --- a/web/lib/pkgfuncs.inc.php +++ b/web/lib/pkgfuncs.inc.php @@ -755,6 +755,11 @@ function pkg_search_page($SID="") { $K = "%" . addcslashes($_GET['K'], '%_') . "%"; $q_where .= "AND (Packages.Name LIKE " . $dbh->quote($K) . ") "; } + elseif (isset($_GET["SeB"]) && $_GET["SeB"] == "nd") { + /* Search by name. */ + $K = "%" . addcslashes($_GET['K'], '%_') . "%"; + $q_where .= "AND (Packages.Name LIKE " . $dbh->quote($K) . " OR Packages.Description LIKE " . $dbh->quote($K) . ") "; + }
It is actually intended that the default search also matches keywords, see commit 5fb7a74 (Replace categories with keywords, 2015-06-13). I agree that the current naming is slightly misleading, though, so I am open for suggestions. "Name, Description and Keywords" is too long. Something like "Keyword Search" is fine but might be confused with the "Keywords" search mode.
elseif (isset($_GET["SeB"]) && $_GET["SeB"] == "b") { /* Search by package base name. */ $K = "%" . addcslashes($_GET['K'], '%_') . "%"; -- 1.7.3.4
There is a search by 'package name & description' according to the function comment. File: pkgfuncs.inc.php /* ... SeB- property that search string (K) represents values: n - package name nd - package name & description b - package base name N - package name (exact match) B - package base name (exact match) k - package keyword(s) m - package maintainer's username s - package submitter's username ... */ Correct me if I'm wrong, but this patch does not break search functionality using web-form. The patch would work only if user manually specifies 'nd' in url. Default search uses name and keywords. So, it looks good to me :)
On Mon, 09 Jan 2017 at 03:25:56, Nodiv Byzero via aur-dev wrote:
There is a search by 'package name & description' according to the function comment. [...] Correct me if I'm wrong, but this patch does not break search functionality using web-form. The patch would work only if user manually specifies 'nd' in url. Default search uses name and keywords.
So, it looks good to me :)
Search by "Name, Description" is the default on the package search page, see [1]. [1] https://aur.archlinux.org/packages/
I was wrong, You're right !
participants (2)
-
Lukas Fleischer
-
Nodiv Byzero