API: Remove dbg, txt, and yaml formats
[lhc/web/wiklou.git] / includes / api / ApiQueryPrefixSearch.php
index 8eb644f..25ff07c 100644 (file)
@@ -48,6 +48,12 @@ class ApiQueryPrefixSearch extends ApiQueryGeneratorBase {
                $searcher = new TitlePrefixSearch;
                $titles = $searcher->searchWithVariants( $search, $limit + 1, $namespaces, $offset );
                if ( $resultPageSet ) {
+                       $resultPageSet->setRedirectMergePolicy( function( array $current, array $new ) {
+                               if ( !isset( $current['index'] ) || $new['index'] < $current['index'] ) {
+                                       $current['index'] = $new['index'];
+                               }
+                               return $current;
+                       } );
                        if ( count( $titles ) > $limit ) {
                                $this->setContinueEnumParameter( 'offset', $offset + $params['limit'] );
                                array_pop( $titles );