* @ingroup Search
*/
+use MediaWiki\MediaWikiServices;
+
/**
* Search engine hook base class for Oracle (ConText).
* @ingroup Search
if ( is_null( $this->namespaces ) ) {
return '';
}
- if ( !count( $this->namespaces ) ) {
+ if ( $this->namespaces === [] ) {
$namespaces = '0';
} else {
$namespaces = $this->db->makeList( $this->namespaces );
* @return string
*/
private function parseQuery( $filteredText, $fulltext ) {
- global $wgContLang;
$lc = $this->legalSearchChars( self::CHARS_NO_SYNTAX );
$this->searchTerms = [];
foreach ( $m as $terms ) {
// Search terms in all variant forms, only
// apply on wiki with LanguageConverter
- $temp_terms = $wgContLang->autoConvertToAllVariants( $terms[2] );
+ $temp_terms = MediaWikiServices::getInstance()->getContentLanguage()->
+ autoConvertToAllVariants( $terms[2] );
if ( is_array( $temp_terms ) ) {
$temp_terms = array_unique( array_values( $temp_terms ) );
foreach ( $temp_terms as $t ) {
}
private function escapeTerm( $t ) {
- global $wgContLang;
- $t = $wgContLang->normalizeForSearch( $t );
+ $t = MediaWikiServices::getInstance()->getContentLanguage()->normalizeForSearch( $t );
$t = isset( $this->reservedWords[strtoupper( $t )] ) ? '{' . $t . '}' : $t;
$t = preg_replace( '/^"(.*)"$/', '($1)', $t );
$t = preg_replace( '/([-&|])/', '\\\\$1', $t );
[] );
}
- public static function legalSearchChars( $type = self::CHARS_ALL ) {
+ public function legalSearchChars( $type = self::CHARS_ALL ) {
$searchChars = parent::legalSearchChars( $type );
if ( $type === self::CHARS_ALL ) {
$searchChars = "\"" . $searchChars;