*/
protected $fulltext;
+ /**
+ * @var string
+ */
+ protected $sort;
+
/**
* @var bool
*/
$this->setExtraParam( 'prefix', $this->mPrefix );
}
+ $this->sort = $request->getVal( 'sort', SearchEngine::DEFAULT_SORT );
+ if ( $this->sort !== SearchEngine::DEFAULT_SORT ) {
+ $this->setExtraParam( 'sort', $this->sort );
+ }
+
$user = $this->getUser();
# Extract manually requested namespaces
$search->setFeatureData( 'rewrite', $this->runSuggestion );
$search->setLimitOffset( $this->limit, $this->offset );
$search->setNamespaces( $this->namespaces );
+ $search->setSort( $this->sort );
$search->prefix = $this->mPrefix;
Hooks::run( 'SpecialSearchSetupEngine', [ $this, $this->profile, $search ] );
*/
public function getSearchEngine() {
if ( $this->searchEngine === null ) {
+ $services = MediaWikiServices::getInstance();
$this->searchEngine = $this->searchEngineType ?
- MediaWikiServices::getInstance()->getSearchEngineFactory()->create( $this->searchEngineType ) :
- MediaWikiServices::getInstance()->newSearchEngine();
+ $services->getSearchEngineFactory()->create( $this->searchEngineType ) :
+ $services->newSearchEngine();
}
return $this->searchEngine;