if($wgMWSuggestTemplate)
return $wgMWSuggestTemplate;
else
- return $wgServer . $wgScriptPath . '/api.php?action=opensearch&search={searchTerms}&namespace={namespaces}';
+ return $wgServer . $wgScriptPath . '/api.php?action=opensearch&search={searchTerms}&namespace={namespaces}&suggest=1';
}
}
}
public function execute() {
+ global $wgEnableMWSuggest;
$params = $this->extractRequestParams();
$search = $params['search'];
$limit = $params['limit'];
$namespaces = $params['namespace'];
+ $suggest = $params['suggest'];
+ # $wgEnableMWSuggest hit incoming when $wgEnableMWSuggest is disabled
+ if( $suggest && !$wgEnableMWSuggest ) return;
// Open search results may be stored for a very long time
$this->getMain()->setCacheMaxAge(1200);
public function getAllowedParams() {
return array (
'search' => null,
- 'limit' => array (
+ 'limit' => array(
ApiBase :: PARAM_DFLT => 10,
ApiBase :: PARAM_TYPE => 'limit',
ApiBase :: PARAM_MIN => 1,
ApiBase :: PARAM_TYPE => 'namespace',
ApiBase :: PARAM_ISMULTI => true
),
+ 'suggest' => array(
+ ApiBase :: PARAM_TYPE => 'integer'
+ ),
);
}