if ( $alternatives[0] === null ) {
$alternatives[0] = self::$BACKEND_NULL_PARAM;
}
- $this->allowedParams['backend'] = [
+ $params['backend'] = [
ApiBase::PARAM_DFLT => $searchConfig->getSearchType(),
ApiBase::PARAM_TYPE => $alternatives,
];
* will be set:
* - backend: which search backend to use
* - limit: mandatory
- * - offset: optional, if set limit will be incremented by
- * one ( to support the continue parameter )
+ * - offset: optional
* - namespace: mandatory
* - search engine profiles defined by SearchApi::getSearchProfileParams()
* @param string[]|null $params API request params (must be sanitized by
*/
public function buildSearchEngine( array $params = null ) {
if ( $params != null ) {
- $type = isset( $params['backend'] ) ? $params['backend'] : null;
+ $type = $params['backend'] ?? null;
if ( $type === self::$BACKEND_NULL_PARAM ) {
$type = null;
}
$searchEngine = MediaWikiServices::getInstance()->getSearchEngineFactory()->create( $type );
$limit = $params['limit'];
$searchEngine->setNamespaces( $params['namespace'] );
- $offset = null;
- if ( isset( $params['offset'] ) ) {
- // If the API supports offset then it probably
- // wants to fetch limit+1 so it can check if
- // more results are available to properly set
- // the continue param
- $offset = $params['offset'];
- $limit += 1;
- }
+ $offset = isset( $params['offset'] ) ? $params['offset'] : null;
$searchEngine->setLimitOffset( $limit, $offset );
// Initialize requested search profiles.