[aur-dev] [PATCH 1/2] Fix type of FlaggerUID in table PackageBases
Signed-off-by: Marcel Korpel <marcel.korpel@gmail.com> --- schema/aur-schema.sql | 2 +- upgrading/4.1.0.txt | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/schema/aur-schema.sql b/schema/aur-schema.sql index ff137dc..2c45a97 100644 --- a/schema/aur-schema.sql +++ b/schema/aur-schema.sql @@ -85,7 +85,7 @@ CREATE TABLE PackageBases ( FlaggerComment VARCHAR(255) NOT NULL, SubmittedTS BIGINT UNSIGNED NOT NULL, ModifiedTS BIGINT UNSIGNED NOT NULL, - FlaggerUID BIGINT UNSIGNED NULL DEFAULT NULL, -- who flagged the package out-of-date? + FlaggerUID INTEGER UNSIGNED NULL DEFAULT NULL, -- who flagged the package out-of-date? SubmitterUID INTEGER UNSIGNED NULL DEFAULT NULL, -- who submitted it? MaintainerUID INTEGER UNSIGNED NULL DEFAULT NULL, -- User PackagerUID INTEGER UNSIGNED NULL DEFAULT NULL, -- Last packager diff --git a/upgrading/4.1.0.txt b/upgrading/4.1.0.txt index e9545ff..439562f 100644 --- a/upgrading/4.1.0.txt +++ b/upgrading/4.1.0.txt @@ -13,6 +13,7 @@ package out-of-date: ---- ALTER TABLE PackageBases - ADD COLUMN FlaggerUID BIGINT UNSIGNED NULL DEFAULT NULL, - ADD COLUMN FlaggerComment VARCHAR(255) NOT NULL; + ADD COLUMN FlaggerUID INTEGER UNSIGNED NULL DEFAULT NULL, + ADD COLUMN FlaggerComment VARCHAR(255) NOT NULL, + ADD FOREIGN KEY (FlaggerUID) REFERENCES Users(ID) ON DELETE SET NULL; ---- -- 2.5.2
Implements FS#45619. Signed-off-by: Marcel Korpel <marcel.korpel@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
On Fri, 18 Sep 2015 at 23:12:14, Marcel Korpel wrote:
Implements FS#45619.
Signed-off-by: Marcel Korpel <marcel.korpel@gmail.com> --- web/lib/pkgfuncs.inc.php | 7 +++++++ web/template/pkg_search_form.php | 1 + 2 files changed, 8 insertions(+)
Thanks for implementing this! One comment below.
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']) . ") "; [...]
I wonder whether, instead of doing this, we should enable the keyword search mode when searching by keywords only, i.e. use the default search and drop the Packages.Name and Description conditions... Regards, Lukas
* Lukas Fleischer <lfleischer@archlinux.org> (Sat, 19 Sep 2015 15:26:09 +0200):
I wonder whether, instead of doing this, we should enable the keyword search mode when searching by keywords only, i.e. use the default search and drop the Packages.Name and Description conditions...
You mean change the default search method to search for keywords only? I don't think I completely understand you. Best, Marcel
On Sun, 20 Sep 2015 at 20:14:08, Marcel Korpel wrote:
* Lukas Fleischer <lfleischer@archlinux.org> (Sat, 19 Sep 2015 15:26:09 +0200):
I wonder whether, instead of doing this, we should enable the keyword search mode when searching by keywords only, i.e. use the default search and drop the Packages.Name and Description conditions...
You mean change the default search method to search for keywords only? I don't think I completely understand you. [...]
No, sorry for being vague. I am talking about using the more sophisticated search mode that we use by default (i.e. for "Name, Description") and that we call "keyword search" -- not to confuse with searching for keywords only -- in the source code. One of the ideas of that search mode is that users can type "command line calendar" to search for packages containing all three keywords (as substrings). Using that advanced search for a "keywords only" search probably requires some code refactoring, though. Regards, Lukas
On Fri, 18 Sep 2015 at 23:12:13, Marcel Korpel wrote:
Signed-off-by: Marcel Korpel <marcel.korpel@gmail.com> --- schema/aur-schema.sql | 2 +- upgrading/4.1.0.txt | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) [...]
Applied, thanks!
participants (2)
-
Lukas Fleischer
-
Marcel Korpel