Merge "RevisionStoreDbTestBase, remove redundant needsDB override"
[lhc/web/wiklou.git] / includes / api / SearchApi.php
index 40d4778..70942f8 100644 (file)
@@ -76,7 +76,7 @@ trait SearchApi {
                        if ( $alternatives[0] === null ) {
                                $alternatives[0] = self::$BACKEND_NULL_PARAM;
                        }
-                       $this->allowedParams['backend'] = [
+                       $params['backend'] = [
                                ApiBase::PARAM_DFLT => $searchConfig->getSearchType(),
                                ApiBase::PARAM_TYPE => $alternatives,
                        ];
@@ -140,8 +140,7 @@ trait SearchApi {
         * 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
@@ -157,15 +156,7 @@ trait SearchApi {
                        $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 = $params['offset'] ?? null;
                        $searchEngine->setLimitOffset( $limit, $offset );
 
                        // Initialize requested search profiles.