Merge "Allow setting default thumb size in parser tests"
[lhc/web/wiklou.git] / includes / search / SearchPostgres.php
index 7f19ed1..142e5fd 100644 (file)
@@ -3,7 +3,7 @@
  * PostgreSQL search engine
  *
  * Copyright © 2006-2007 Greg Sabino Mullane <greg@turnstep.com>
- * http://www.mediawiki.org/
+ * https://www.mediawiki.org/
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
  * Search engine hook base class for Postgres
  * @ingroup Search
  */
-class SearchPostgres extends SearchEngine {
-
-       /**
-        * @var DatabasePostgres
-        */
-       protected $db;
-       /**
-        * Creates an instance of this class
-        * @param $db DatabaseSqlite: database object
-        */
-       function __construct( $db ) {
-               parent::__construct( $db );
-       }
-
+class SearchPostgres extends SearchDatabase {
        /**
         * Perform a full text search query via tsearch2 and return a result set.
         * Currently searches a page's current title (page.page_title) and
@@ -153,8 +140,8 @@ class SearchPostgres extends SearchEngine {
                $searchstring = $this->parseQuery( $term );
 
                ## We need a separate query here so gin does not complain about empty searches
-               $SQL = "SELECT to_tsquery($searchstring)";
-               $res = $this->db->query( $SQL );
+               $sql = "SELECT to_tsquery($searchstring)";
+               $res = $this->db->query( $sql );
                if ( !$res ) {
                        ## TODO: Better output (example to catch: one 'two)
                        die( "Sorry, that was not a valid search string. Please go back and try again" );
@@ -209,10 +196,10 @@ class SearchPostgres extends SearchEngine {
 
        function update( $pageid, $title, $text ) {
                ## We don't want to index older revisions
-               $SQL = "UPDATE pagecontent SET textvector = NULL WHERE old_id IN " .
+               $sql = "UPDATE pagecontent SET textvector = NULL WHERE old_id IN " .
                                "(SELECT rev_text_id FROM revision WHERE rev_page = " . intval( $pageid ) .
                                " ORDER BY rev_text_id DESC OFFSET 1)";
-               $this->db->query( $SQL );
+               $this->db->query( $sql );
                return true;
        }
 
@@ -230,6 +217,7 @@ class PostgresSearchResult extends SearchResult {
                parent::__construct( $row );
                $this->score = $row->score;
        }
+
        function getScore() {
                return $this->score;
        }