From b1b4eb2679bebcfee968d40299487b07bebacf46 Mon Sep 17 00:00:00 2001 From: Robert Sesek Date: Wed, 26 Jul 2006 00:21:19 +0000 Subject: [PATCH] r956: Cleaning up the search queries because there's no need for the mondo joins --- search.php | 24 ++++-------------------- 1 file changed, 4 insertions(+), 20 deletions(-) diff --git a/search.php b/search.php index a5d87cc..3dc3388 100644 --- a/search.php +++ b/search.php @@ -246,16 +246,10 @@ if ($_REQUEST['do'] == 'process') // ------------------------------------------------------------------- // do the search $query = " - SELECT bug.*, comment.commentid, - user1.displayname AS firstreport, - user2.displayname AS lastpost + SELECT bug.*, comment.commentid FROM " . TABLE_PREFIX . "bug AS bug LEFT JOIN " . TABLE_PREFIX . "comment AS comment ON (bug.bugid = comment.bugid) - LEFT JOIN " . TABLE_PREFIX . "user AS user1 - ON (bug.userid = user1.userid) - LEFT JOIN " . TABLE_PREFIX . "user AS user2 - ON (bug.lastpostby = user2.userid) LEFT JOIN " . TABLE_PREFIX . "bugvaluefill AS bugfieldvalue ON (bug.bugid = bugfieldvalue.bugid) WHERE bug.bugid <> 0 @@ -381,17 +375,7 @@ if ($_REQUEST['do'] == 'results') } else { - $search = $db->query(" - SELECT bug.*, user1.displayname AS firstreport, - user2.displayname AS lastpost - FROM " . TABLE_PREFIX . "bug AS bug - LEFT JOIN " . TABLE_PREFIX . "user AS user1 - ON (bug.userid = user1.userid) - LEFT JOIN " . TABLE_PREFIX . "user AS user2 - ON (bug.lastpostby = user2.userid) - WHERE bug.bugid IN ($search[ids]) - $search[orderby]" - ); + $search = $db->query("SELECT * FROM " . TABLE_PREFIX . "bug WHERE bugid IN ($search[ids]) $search[orderby]"); while ($bug = $db->fetch_array($search)) { $results[] = $bug; @@ -411,8 +395,8 @@ if ($_REQUEST['do'] == 'results') $bug['resolution'] = $bugsys->datastore['resolution']["$bug[resolution]"]['resolution']; $bug['priority'] = $bugsys->datastore['priority']["$bug[priority]"]['priority']; $bug['severity'] = $bugsys->datastore['severity']["$bug[severity]"]['severity']; - $bug['lastposttime'] = (($bug['hiddendisplay']) ? $bug['hiddenlastposttime'] : $bug['lastposttime']); - $bug['lastpost'] = (($bug['hiddendisplay']) ? $bug['hiddenlastpost'] : $bug['lastpost']); + $bug['lastposttime'] = ($bug['hiddendisplay'] ? $bug['hiddenlastposttime'] : $bug['lastposttime']); + $bug['lastpost'] = ($bug['hiddendisplay'] ? $bug['hiddenlastpostbyname'] : $bug['lastpostbyname']); $bug['lastposttime'] = $datef->format($bugsys->options['dateformat'], $bug['lastposttime']); $bug['urladd'] = "&hilight=$hilight"; eval('$bugs .= "' . $template->fetch('trackerhome_bits') . '";'); -- 2.22.5