From 75df09b077736a75a01ce1c3e8e25cbbbab54c61 Mon Sep 17 00:00:00 2001 From: Greg Sabino Mullane Date: Wed, 29 Nov 2006 16:49:10 +0000 Subject: [PATCH] Minor tweaks to search query. --- includes/SearchPostgres.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/includes/SearchPostgres.php b/includes/SearchPostgres.php index fb4dd5be8f..553f734a43 100644 --- a/includes/SearchPostgres.php +++ b/includes/SearchPostgres.php @@ -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 ); -- 2.20.1