Don't call legalSearchChars() statically so it can properly inherit
[lhc/web/wiklou.git] / includes / search / SearchMySQL.php
index c3edf51..cc20d02 100644 (file)
@@ -36,14 +36,14 @@ class SearchMySQL extends SearchDatabase {
         * Parse the user's query and transform it into an SQL fragment which will
         * become part of a WHERE clause
         *
-        * @param $filteredText string
-        * @param $fulltext string
+        * @param string $filteredText
+        * @param string $fulltext
         *
         * @return string
         */
        function parseQuery( $filteredText, $fulltext ) {
                global $wgContLang;
-               $lc = SearchEngine::legalSearchChars(); // Minus format chars
+               $lc = $this->legalSearchChars(); // Minus format chars
                $searchon = '';
                $this->searchTerms = array();
 
@@ -152,8 +152,8 @@ class SearchMySQL extends SearchDatabase {
        /**
         * Perform a full text search query and return a result set.
         *
-        * @param string $term raw search term
-        * @return MySQLSearchResultSet
+        * @param string $term Raw search term
+        * @return SqlSearchResultSet
         */
        function searchText( $term ) {
                return $this->searchInternal( $term, true );
@@ -162,8 +162,8 @@ class SearchMySQL extends SearchDatabase {
        /**
         * Perform a title-only search query and return a result set.
         *
-        * @param string $term raw search term
-        * @return MySQLSearchResultSet
+        * @param string $term Raw search term
+        * @return SqlSearchResultSet
         */
        function searchTitle( $term ) {
                return $this->searchInternal( $term, false );
@@ -199,7 +199,7 @@ class SearchMySQL extends SearchDatabase {
                        $totalResult->free();
                }
 
-               return new MySQLSearchResultSet( $resultSet, $this->searchTerms, $total );
+               return new SqlSearchResultSet( $resultSet, $this->searchTerms, $total );
        }
 
        public function supports( $feature ) {
@@ -213,14 +213,12 @@ class SearchMySQL extends SearchDatabase {
 
        /**
         * Add special conditions
-        * @param $query Array
+        * @param array $query
         * @since 1.18
         */
        protected function queryFeatures( &$query ) {
                foreach ( $this->features as $feature => $value ) {
-                       if ( $feature === 'list-redirects' && !$value ) {
-                               $query['conds']['page_is_redirect'] = 0;
-                       } elseif ( $feature === 'title-suffix-filter' && $value ) {
+                       if ( $feature === 'title-suffix-filter' && $value ) {
                                $query['conds'][] = 'page_title' . $this->db->buildLike( $this->db->anyString(), $value );
                        }
                }
@@ -228,7 +226,7 @@ class SearchMySQL extends SearchDatabase {
 
        /**
         * Add namespace conditions
-        * @param $query Array
+        * @param array $query
         * @since 1.18 (changed)
         */
        function queryNamespaces( &$query ) {
@@ -242,7 +240,7 @@ class SearchMySQL extends SearchDatabase {
 
        /**
         * Add limit options
-        * @param $query Array
+        * @param array $query
         * @since 1.18
         */
        protected function limitResult( &$query ) {
@@ -253,9 +251,9 @@ class SearchMySQL extends SearchDatabase {
        /**
         * Construct the SQL query to do the search.
         * The guts shoulds be constructed in queryMain()
-        * @param $filteredTerm String
-        * @param $fulltext Boolean
-        * @return Array
+        * @param string $filteredTerm
+        * @param bool $fulltext
+        * @return array
         * @since 1.18 (changed)
         */
        function getQuery( $filteredTerm, $fulltext ) {
@@ -277,8 +275,8 @@ class SearchMySQL extends SearchDatabase {
 
        /**
         * Picks which field to index on, depending on what type of query.
-        * @param $fulltext Boolean
-        * @return String
+        * @param bool $fulltext
+        * @return string
         */
        function getIndexField( $fulltext ) {
                return $fulltext ? 'si_text' : 'si_title';
@@ -287,9 +285,9 @@ class SearchMySQL extends SearchDatabase {
        /**
         * Get the base part of the search query.
         *
-        * @param &$query array Search query array
-        * @param $filteredTerm String
-        * @param $fulltext Boolean
+        * @param array &$query Search query array
+        * @param string $filteredTerm
+        * @param bool $fulltext
         * @since 1.18 (changed)
         */
        function queryMain( &$query, $filteredTerm, $fulltext ) {
@@ -328,9 +326,9 @@ class SearchMySQL extends SearchDatabase {
         * Create or update the search index record for the given page.
         * Title and text should be pre-processed.
         *
-        * @param $id Integer
-        * @param $title String
-        * @param $text String
+        * @param int $id
+        * @param string $title
+        * @param string $text
         */
        function update( $id, $title, $text ) {
                $dbw = wfGetDB( DB_MASTER );
@@ -347,8 +345,8 @@ class SearchMySQL extends SearchDatabase {
         * Update a search index record's title only.
         * Title should be pre-processed.
         *
-        * @param $id Integer
-        * @param $title String
+        * @param int $id
+        * @param string $title
         */
        function updateTitle( $id, $title ) {
                $dbw = wfGetDB( DB_MASTER );
@@ -364,8 +362,8 @@ class SearchMySQL extends SearchDatabase {
         * Delete an indexed page
         * Title should be pre-processed.
         *
-        * @param Integer $id Page id that was deleted
-        * @param String $title Title of page that was deleted
+        * @param int $id Page id that was deleted
+        * @param string $title Title of page that was deleted
         */
        function delete( $id, $title ) {
                $dbw = wfGetDB( DB_MASTER );
@@ -454,17 +452,3 @@ class SearchMySQL extends SearchDatabase {
                return self::$mMinSearchLength;
        }
 }
-
-/**
- * @ingroup Search
- */
-class MySQLSearchResultSet extends SqlSearchResultSet {
-       function __construct( $resultSet, $terms, $totalHits = null ) {
-               parent::__construct( $resultSet, $terms );
-               $this->mTotalHits = $totalHits;
-       }
-
-       function getTotalHits() {
-               return $this->mTotalHits;
-       }
-}