Merge "mediawiki.api.upload: Use this.defaults.parameters instead of all-custom params"
[lhc/web/wiklou.git] / includes / api / ApiQueryPrefixSearch.php
index 069e30b..8eb644f 100644 (file)
@@ -48,6 +48,10 @@ class ApiQueryPrefixSearch extends ApiQueryGeneratorBase {
                $searcher = new TitlePrefixSearch;
                $titles = $searcher->searchWithVariants( $search, $limit + 1, $namespaces, $offset );
                if ( $resultPageSet ) {
+                       if ( count( $titles ) > $limit ) {
+                               $this->setContinueEnumParameter( 'offset', $offset + $params['limit'] );
+                               array_pop( $titles );
+                       }
                        $resultPageSet->populateFromTitles( $titles );
                        foreach ( $titles as $index => $title ) {
                                $resultPageSet->setGeneratorData( $title, array( 'index' => $index + $offset + 1 ) );
@@ -65,7 +69,7 @@ class ApiQueryPrefixSearch extends ApiQueryGeneratorBase {
                                        'title' => $title->getPrefixedText(),
                                );
                                if ( $title->isSpecialPage() ) {
-                                       $vals['special'] = '';
+                                       $vals['special'] = true;
                                } else {
                                        $vals['pageid'] = intval( $title->getArticleId() );
                                }
@@ -75,7 +79,7 @@ class ApiQueryPrefixSearch extends ApiQueryGeneratorBase {
                                        break;
                                }
                        }
-                       $result->setIndexedTagName_internal(
+                       $result->addIndexedTagName(
                                array( 'query', $this->getModuleName() ), $this->getModulePrefix()
                        );
                }