35 $configuredClass = $this->config->getSearchType();
36 $alternativesClasses = $this->config->getSearchTypes();
38 $lb = MediaWikiServices::getInstance()->getDBLoadBalancer();
39 if (
$type !==
null && in_array(
$type, $alternativesClasses ) ) {
41 } elseif ( $configuredClass !==
null ) {
42 $class = $configuredClass;
44 $class = self::getSearchEngineClass( $lb );
47 $mappings = $this->config->getSearchMappings();
49 if ( isset( $mappings[$class] ) ) {
50 $spec = $mappings[$class];
53 $spec = [
'class' => $class ];
58 if ( isset( $spec[
'class'] ) && is_subclass_of( $spec[
'class'], SearchDatabase::class ) ) {
59 $args[
'extraArgs'][] = $lb;
63 $engine = ObjectFactory::getObjectFromSpec( $spec,
$args );
64 $engine->setHookContainer( $this->hookContainer );