Re: [aur-dev] [PATCH] add search only by name and use it as default

2010-04-15 Thread Loui Chang
On Wed 10 Mar 2010 20:01 +0100, Andrea Scarpino wrote:
 On Wednesday 10 March 2010 19:50:25 Nathan Wayde wrote:
  Please don't make it name-only by default, the search is crappy enough
  already without the extra effort to make it kinda-work-sorta.

 I think is better to search by name as default.

Please test your patches!

Missing a closing parenthesis:
+   $q.= AND (Name LIKE '%.$_GET['K'].%' ;

Also, the default should remain name and desc even when opening up the
advanced search, so it should be the first option in the combobox.

Thanks for the patch. I've applied those changes.


[aur-dev] [PATCH] add search only by name and use it as default

2010-03-10 Thread Andrea Scarpino
This add the ability to search packages only by name and set it as default.
The possibility to search by both is kept using Advanced Search.

-- 
Andrea
From 4539d5ddc15728726954de85056fd4c624fc72b9 Mon Sep 17 00:00:00 2001
From: Andrea Scarpino and...@archlinux.org
Date: Wed, 10 Mar 2010 19:32:26 +0100
Subject: [PATCH] add search only by name and use it as default

---
 web/lib/pkgfuncs.inc |   12 +---
 web/template/pkg_search_form.php |2 +-
 2 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/web/lib/pkgfuncs.inc b/web/lib/pkgfuncs.inc
index 74d418f..ded8516 100644
--- a/web/lib/pkgfuncs.inc
+++ b/web/lib/pkgfuncs.inc
@@ -365,7 +365,8 @@ function package_details($id=0, $SID=) {
  *  v - number of votes
  *  m - maintainer username
  *SeB- property that search string (K) represents
- *  values: nd - package namedescription
+ *  values: n  - package name
+ *  nd - package name  description
  *  m  - package maintainer's username
  *  s  - package submitter's username
  *do_Orphans- boolean. whether to search packages
@@ -466,16 +467,21 @@ function pkg_search_page($SID=) {
 		if ($_GET[SeB] == m) {
 			$q.= AND Users.Username = '.$_GET['K'].' ;
 		}
+		# Search by submitter
 		elseif ($_GET[SeB] == s) {
 			// FIXME: this shouldn't be making 2 queries
 			//kill the call to uid_from_username
 			$q.= AND SubmitterUID = .uid_from_username($_GET['K']). ;
-		// the default behavior, query the name/description
 		}
-		else {
+		# Search by name and description
+		elseif ($_GET[SeB] == nd) {
 			$q.= AND (Name LIKE '%.$_GET['K'].%' OR ;
 			$q.= Description LIKE '%.$_GET['K'].%') ;
 		}
+		# Search by name (Default)
+		else {
+			$q.= AND (Name LIKE '%.$_GET['K'].%' ;
+		}
 	}
 
 	if ($_GET[do_Orphans]) {
diff --git a/web/template/pkg_search_form.php b/web/template/pkg_search_form.php
index 567db5a..e101c12 100644
--- a/web/template/pkg_search_form.php
+++ b/web/template/pkg_search_form.php
@@ -39,7 +39,7 @@
 	label?php print __(Search by); ?/label
 		select name='SeB'
 			?php
-			$searchby = array('nd' = 'Name', 'm'  = 'Maintainer', 's'  = 'Submitter');
+			$searchby = array('n' = 'Name', 'nd' = 'Name  Desc', 'm'  = 'Maintainer', 's'  = 'Submitter');
 			foreach ($searchby as $k = $v):
 if ($_REQUEST['SeB'] == $k):
 			?
-- 
1.7.0.2



Re: [aur-dev] [PATCH] add search only by name and use it as default

2010-03-10 Thread Nathan Wayde

On 10/03/10 18:36, Andrea Scarpino wrote:

This add the ability to search packages only by name and set it as default.
The possibility to search by both is kept using Advanced Search.

Please don't make it name-only by default, the search is crappy enough 
already without the extra effort to make it kinda-work-sorta.


Re: [aur-dev] [PATCH] add search only by name and use it as default

2010-03-10 Thread Laszlo Papp
On Wed, Mar 10, 2010 at 8:01 PM, Andrea Scarpino and...@archlinux.orgwrote:

 On Wednesday 10 March 2010 19:50:25 Nathan Wayde wrote:
  Please don't make it name-only by default, the search is crappy enough
  already without the extra effort to make it kinda-work-sorta.
 I think is better to search by name as default.
 Anyway, I am attaching a patch that only add search by name, so this is up
 to
 Loui.

 --
 Andrea


I agree with Nathan, it would be a restriction that I don't know why it's
good, and it's really 'crappy enough' to search, and with name only...

Best Regards,
Laszlo Papp