Merge "Rename autonym for 'no' from 'norsk bokmål' to 'norsk'"
[lhc/web/wiklou.git] / includes / search / SearchDatabase.php
index 38c60d0..643c2c1 100644 (file)
@@ -21,6 +21,8 @@
  * @ingroup Search
  */
 
+use Wikimedia\Rdbms\IDatabase;
+
 /**
  * Base search engine base class for database-backed searches
  * @ingroup Search
@@ -33,7 +35,6 @@ class SearchDatabase extends SearchEngine {
        protected $db;
 
        /**
-        * Constructor
         * @param IDatabase $db The database to search from
         */
        public function __construct( IDatabase $db = null ) {
@@ -51,7 +52,10 @@ class SearchDatabase extends SearchEngine {
         * @return string
         */
        protected function filter( $text ) {
-               $lc = $this->legalSearchChars();
+               // List of chars allowed in the search query.
+               // This must include chars used in the search syntax.
+               // Usually " (phrase) or * (wildcards) if supported by the engine
+               $lc = $this->legalSearchChars( self::CHARS_ALL );
                return trim( preg_replace( "/[^{$lc}]/", " ", $text ) );
        }
 }