Merge "Revert "Log the reason why revision->getContent() returns null""
[lhc/web/wiklou.git] / includes / search / SearchSqlite.php
index 5a8995d..af29212 100644 (file)
@@ -44,7 +44,7 @@ class SearchSqlite extends SearchDatabase {
         */
        function parseQuery( $filteredText, $fulltext ) {
                global $wgContLang;
-               $lc = $this->legalSearchChars(); // Minus format chars
+               $lc = $this->legalSearchChars( self::CHARS_NO_SYNTAX ); // Minus syntax chars (" and *)
                $searchon = '';
                $this->searchTerms = [];
 
@@ -52,9 +52,9 @@ class SearchSqlite extends SearchDatabase {
                if ( preg_match_all( '/([-+<>~]?)(([' . $lc . ']+)(\*?)|"[^"]*")/',
                                $filteredText, $m, PREG_SET_ORDER ) ) {
                        foreach ( $m as $bits ) {
-                               MediaWiki\suppressWarnings();
+                               Wikimedia\suppressWarnings();
                                list( /* all */, $modifier, $term, $nonQuoted, $wildcard ) = $bits;
-                               MediaWiki\restoreWarnings();
+                               Wikimedia\restoreWarnings();
 
                                if ( $nonQuoted != '' ) {
                                        $term = $nonQuoted;
@@ -141,8 +141,13 @@ class SearchSqlite extends SearchDatabase {
                return $regex;
        }
 
-       public function legalSearchCharsForUpdate() {
-               return "\"*" . parent::legalSearchCharsForUpdate();
+       public static function legalSearchChars( $type = self::CHARS_ALL ) {
+               $searchChars = parent::legalSearchChars( $type );
+               if ( $type === self::CHARS_ALL ) {
+                       // " for phrase, * for wildcard
+                       $searchChars = "\"*" . $searchChars;
+               }
+               return $searchChars;
        }
 
        /**