diff options
Diffstat (limited to 'includes/SearchPostgres.php')
-rw-r--r-- | includes/SearchPostgres.php | 9 |
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)"; } |