config = $config; } /** * Create SearchEngine of the given type. * @param string $type * @return SearchEngine */ public function create( $type = null ) { $dbr = null; $configType = $this->config->getSearchType(); $alternatives = $this->config->getSearchTypes(); if ( $type && in_array( $type, $alternatives ) ) { $class = $type; } elseif ( $configType !== null ) { $class = $configType; } else { $dbr = wfGetDB( DB_REPLICA ); $class = $dbr->getSearchEngine(); } $search = new $class( $dbr ); return $search; } }