db = $db; } else { $this->db = wfGetDB( DB_REPLICA ); } } /** * Return a 'cleaned up' search string * * @param string $text * @return string */ protected function filter( $text ) { // 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 ) ); } }