Fixed SearchMySQL broken by r80856
authorMax Semenik <maxsem@users.mediawiki.org>
Thu, 21 Apr 2011 05:43:52 +0000 (05:43 +0000)
committerMax Semenik <maxsem@users.mediawiki.org>
Thu, 21 Apr 2011 05:43:52 +0000 (05:43 +0000)
includes/search/SearchMySQL.php

index 4adfef4..d68fca0 100644 (file)
@@ -290,14 +290,18 @@ class SearchMySQL extends SearchEngine {
        function getCountQuery( $filteredTerm, $fulltext ) {
                $match = $this->parseQuery( $filteredTerm, $fulltext );
 
+               $redir = $this->queryRedirect();
+               $namespaces = $this->queryNamespaces();
+               $conditions = array( 'page_id=si_page', $match );
+               if ( $redir !== '' ) {
+                       $conditions[] = $redir;
+               }
+               if ( $namespaces !== '' ) {
+                       $conditions[] = $namespaces;
+               }
                return $this->db->selectSQLText( array( 'page', 'searchindex' ),
                        'COUNT(*) AS c',
-                       array(
-                               'page_id=si_page',
-                               $match,
-                               $this->queryRedirect(),
-                               $this->queryNamespaces()
-                       ),
+                       $conditions,
                        __METHOD__
                );
        }