Use the srbackend parameter if it's valid.
If it's not, use $wgSearchType if it's not null.
Finally, fall back to the search type of the database.
Bug: 53982
Change-Id: I3605cb4add270543aa20afb037401b2dfbe462f0
$dbr = null;
$alternatives = self::getSearchTypes();
- $type = $type !== null ? $type : $wgSearchType;
+
if ( $type && in_array( $type, $alternatives ) ) {
$class = $type;
+ } elseif ( $wgSearchType !== null ) {
+ $class = $wgSearchType;
} else {
$dbr = wfGetDB( DB_SLAVE );
$class = $dbr->getSearchEngine();
}
+
$search = new $class( $dbr );
$search->setLimitOffset( 0, 0 );
return $search;