Minor tweaks to search query.
authorGreg Sabino Mullane <greg@users.mediawiki.org>
Wed, 29 Nov 2006 16:49:10 +0000 (16:49 +0000)
committerGreg Sabino Mullane <greg@users.mediawiki.org>
Wed, 29 Nov 2006 16:49:10 +0000 (16:49 +0000)
includes/SearchPostgres.php

index fb4dd5b..553f734 100644 (file)
@@ -99,6 +99,7 @@ class SearchPostgres extends SearchEngine {
                $match = $this->parseQuery( $filteredTerm, $fulltext );
 
                $query = "SELECT page_id, page_namespace, page_title, old_text AS page_text ".
+                       "rank(titlevector, to_tsquery('default','$match')) AS rnk ".
                        "FROM page p, revision r, pagecontent c WHERE p.page_latest = r.rev_id " .
                        "AND r.rev_text_id = c.old_id AND $fulltext @@ to_tsquery('default','$match')";
 
@@ -114,7 +115,7 @@ class SearchPostgres extends SearchEngine {
                        $query .=  " AND page_namespace IN ($namespaces)";
                }
 
-               $query .= " ORDER BY rank($fulltext, to_tsquery('default','$fulltext')) DESC";
+               $query .= " ORDER BY rnk DESC, page_id DESC";
 
                $query .= $this->db->limitResult( '', $this->limit, $this->offset );