Changeset 767

Show
Ignore:
Timestamp:
01/14/07 22:55:28 (2 years ago)
Author:
Neal
Message:

Optimize search by removing useless group by statement (backported from 1.3).

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/upload/search.php

    r602 r767  
    431431        if ($search_results != '') 
    432432        { 
    433                 $group_by_sql = ''; 
    434433                switch ($sort_by) 
    435434                { 
     
    451450 
    452451                        default: 
    453                         { 
    454452                                $sort_by_sql = ($show_as == 'topics') ? 't.posted' : 'p.posted'; 
    455  
    456                                 if ($show_as == 'topics') 
    457                                         $group_by_sql = ', t.posted'; 
    458  
    459453                                break; 
    460                         } 
    461454                } 
    462455 
     
    467460                } 
    468461                else 
    469                         $sql = 'SELECT t.id AS tid, t.poster, t.subject, t.last_post, t.last_post_id, t.last_poster, t.num_replies, t.closed, t.forum_id FROM '.$db->prefix.'topics AS t WHERE t.id IN('.$search_results.') GROUP BY t.id, t.poster, t.subject, t.last_post, t.last_post_id, t.last_poster, t.num_replies, t.closed, t.forum_id'.$group_by_sql.' ORDER BY '.$sort_by_sql; 
     462                        $sql = 'SELECT t.id AS tid, t.poster, t.subject, t.last_post, t.last_post_id, t.last_poster, t.num_replies, t.closed, t.forum_id FROM '.$db->prefix.'topics AS t WHERE t.id IN('.$search_results.') ORDER BY '.$sort_by_sql; 
    470463 
    471464