Changeset 229

Show
Ignore:
Timestamp:
2009-02-03 11:12:32 (3 years ago)
Author:
hannes
Message:

ordering of search results by topic first (ticket #101)

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/classes/pages/Newposts.php

    r213 r229  
    6464                if (!isset($INPUT['page']) || $INPUT['page'] == '') { $INPUT['page'] = 1; } 
    6565                $start = ($INPUT['page'] - 1) * $SETTINGS['postsperpage']; 
    66                 $query2 .= ' ORDER BY p.posttime DESC LIMIT ' . $SETTINGS['postsperpage'] . ' OFFSET ' . $start; 
     66                $query2 .= ' ORDER BY p.topic DESC, p.posttime DESC LIMIT ' . $SETTINGS['postsperpage'] . ' OFFSET ' . $start; 
    6767                $q = $C->prepare($query2); 
    6868                $q->bindParam(':timestamp', $_SESSION['lastvisit'], PDO::PARAM_STR, 20); 
  • trunk/classes/pages/Search.php

    r228 r229  
    5555                    switch ($scope[0]) { 
    5656                        case 'all': 
    57                             $query = 'SELECT p.postid, p.topic, p.poster, p.posttime, p.post, t.topictitle FROM ' . $SETTINGS['dbtableprefix'] . 'posts p, ' . $SETTINGS['dbtableprefix'] . 'topics t WHERE t.topicid = p.topic %cond% GROUP BY p.postid, p.topic, p.poster, p.posttime, p.post, t.topictitle ORDER BY p.posttime DESC'; 
     57                            $query = 'SELECT p.postid, p.topic, p.poster, p.posttime, p.post, t.topictitle FROM ' . $SETTINGS['dbtableprefix'] . 'posts p, ' . $SETTINGS['dbtableprefix'] . 'topics t WHERE t.topicid = p.topic %cond% GROUP BY p.postid, p.topic, p.poster, p.posttime, p.post, t.topictitle ORDER BY p.topic DESC, p.posttime DESC'; 
    5858                        break; 
    5959                        case 'category': 
    60                             $query = 'SELECT p.postid, p.topic, p.poster, p.posttime, p.post, t.topictitle FROM ' . $SETTINGS['dbtableprefix'] . 'posts p, ' . $SETTINGS['dbtableprefix'] . 'topics t, ' . $SETTINGS['dbtableprefix'] . 'forums f WHERE f.forum_category=:scope1 AND t.forum=f.forumid AND t.topicid = p.topic %cond% GROUP BY p.postid, p.topic, p.poster, p.posttime, p.post, t.topictitle ORDER BY p.posttime DESC'; 
     60                            $query = 'SELECT p.postid, p.topic, p.poster, p.posttime, p.post, t.topictitle FROM ' . $SETTINGS['dbtableprefix'] . 'posts p, ' . $SETTINGS['dbtableprefix'] . 'topics t, ' . $SETTINGS['dbtableprefix'] . 'forums f WHERE f.forum_category=:scope1 AND t.forum=f.forumid AND t.topicid = p.topic %cond% GROUP BY p.postid, p.topic, p.poster, p.posttime, p.post, t.topictitle ORDER BY p.topic DESC, p.posttime DESC'; 
    6161                        break; 
    6262                        case 'forum': 
    63                             $query = 'SELECT p.postid, p.topic, p.poster, p.posttime, p.post, t.topictitle FROM ' . $SETTINGS['dbtableprefix'] . 'posts p, ' . $SETTINGS['dbtableprefix'] . 'topics t WHERE t.forum=:scope1 AND t.topicid = p.topic %cond% GROUP BY p.postid, p.topic, p.poster, p.posttime, p.post, t.topictitle ORDER BY p.posttime DESC'; 
     63                            $query = 'SELECT p.postid, p.topic, p.poster, p.posttime, p.post, t.topictitle FROM ' . $SETTINGS['dbtableprefix'] . 'posts p, ' . $SETTINGS['dbtableprefix'] . 'topics t WHERE t.forum=:scope1 AND t.topicid = p.topic %cond% GROUP BY p.postid, p.topic, p.poster, p.posttime, p.post, t.topictitle ORDER BY p.topic DESC, p.posttime DESC'; 
    6464                        break; 
    6565                    } 
     
    170170                            $_username = $q->fetchColumn(); 
    171171                            $q = NULL; 
    172                             $query = 'SELECT p.postid, p.topic, p.poster, p.posttime, p.post, t.topictitle FROM ' . $SETTINGS['dbtableprefix'] . 'posts p, ' . $SETTINGS['dbtableprefix'] . 'topics t WHERE t.topicid = p.topic AND p.poster = :username AND p.postedbymember = :memberid %cond% ORDER BY p.posttime DESC'; 
     172                            $query = 'SELECT p.postid, p.topic, p.poster, p.posttime, p.post, t.topictitle FROM ' . $SETTINGS['dbtableprefix'] . 'posts p, ' . $SETTINGS['dbtableprefix'] . 'topics t WHERE t.topicid = p.topic AND p.poster = :username AND p.postedbymember = :memberid %cond% ORDER BY p.topic DESC, p.posttime DESC'; 
    173173                        break; 
    174174                        default: