From cd552adee0456b758ce7c58f08b4baa857fa8ec1 Mon Sep 17 00:00:00 2001 From: Steven Wittens Date: Sun, 27 Feb 2005 02:15:57 +0000 Subject: More search usability improvements! - Clean URLs: search/type/keywords e.g. "search/node/drupal release". The search form is POST submitted, but drupal_gotos to a GET page. This makes it easy to copy/paste search URLs, and makes the pager a lot cleaner. - Remember the search keywords when switching between the search tabs. This is done through the same GET URLs rather than the session, so it does not mess up between multiple browser tabs. - Report which keywords were ignored because they were too short. - #820: Provide search block - Treat multiple wildcards in a row as one --- modules/user/user.module | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'modules/user/user.module') diff --git a/modules/user/user.module b/modules/user/user.module index 74e4350f8..7681cdd82 100644 --- a/modules/user/user.module +++ b/modules/user/user.module @@ -423,8 +423,8 @@ function user_search($op = 'search', $keys = null) { case 'search': $find = array(); // Replace wildcards with MySQL/PostgreSQL wildcards. - $keys = str_replace('*', '%', $keys); - $result = db_query_range("SELECT * FROM {users} WHERE LOWER(name) LIKE '%%%s%%'", strtolower($keys), 0, 20); + $keys = preg_replace('!\*+!', '%', $keys); + $result = pager_query("SELECT * FROM {users} WHERE LOWER(name) LIKE LOWER('%%%s%%')", 15, 0, NULL, $keys); while ($account = db_fetch_object($result)) { $find[] = array('title' => $account->name, 'link' => url("user/$account->uid/view")); } -- cgit v1.2.3