summaryrefslogtreecommitdiff
path: root/includes/SearchPostgres.php
diff options
context:
space:
mode:
authorPierre Schmitz <pierre@archlinux.de>2007-07-18 09:49:48 +0200
committerPierre Schmitz <pierre@archlinux.de>2007-07-18 09:49:48 +0200
commitfd12989ef8eab0fc9816decb8bcabccd1d213ee8 (patch)
tree68b12cc05704f2181a90d69b898f999309a8c036 /includes/SearchPostgres.php
parent1a1c15f5da352895fb32daab8550cb3dca8198ac (diff)
auf 1.10.1 aktualisiert
Diffstat (limited to 'includes/SearchPostgres.php')
-rw-r--r--includes/SearchPostgres.php9
1 files changed, 8 insertions, 1 deletions
diff --git a/includes/SearchPostgres.php b/includes/SearchPostgres.php
index 3a624ced..7c3580e7 100644
--- a/includes/SearchPostgres.php
+++ b/includes/SearchPostgres.php
@@ -115,6 +115,12 @@ class SearchPostgres extends SearchEngine {
* @private
*/
function searchQuery( $term, $fulltext, $colname ) {
+ global $wgDBversion;
+
+ if ( !isset( $wgDBversion ) ) {
+ $this->db->getServerVersion();
+ $wgDBversion = $this->db->numeric_version;
+ }
$searchstring = $this->parseQuery( $term );
@@ -140,8 +146,9 @@ class SearchPostgres extends SearchEngine {
}
}
+ $rankscore = $wgDBversion > 8.2 ? 5 : 1;
$query = "SELECT page_id, page_namespace, page_title, ".
- "rank($fulltext, to_tsquery('default',$searchstring),5) AS score ".
+ "rank($fulltext, to_tsquery('default',$searchstring), $rankscore) AS score ".
"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',$searchstring)";
}