API: Allow generators to return data
[lhc/web/wiklou.git] / includes / api / ApiQueryPrefixSearch.php
index 4abd7f0..95f8483 100644 (file)
@@ -48,6 +48,11 @@ class ApiQueryPrefixSearch extends ApiQueryGeneratorBase {
                $titles = $searcher->searchWithVariants( $search, $limit, $namespaces );
                if ( $resultPageSet ) {
                        $resultPageSet->populateFromTitles( $titles );
+                       /** @todo If this module gets an 'offset' parameter, use it here */
+                       $offset = 1;
+                       foreach ( $titles as $index => $title ) {
+                               $resultPageSet->setGeneratorData( $title, array( 'index' => $index + $offset ) );
+                       }
                } else {
                        $result = $this->getResult();
                        foreach ( $titles as $title ) {
@@ -100,21 +105,10 @@ class ApiQueryPrefixSearch extends ApiQueryGeneratorBase {
                        );
        }
 
-       public function getParamDescription() {
-               return array(
-                       'search' => 'Search string',
-                       'limit' => 'Maximum amount of results to return',
-                       'namespace' => 'Namespaces to search',
-               );
-       }
-
-       public function getDescription() {
-               return 'Perform a prefix search for page titles';
-       }
-
-       public function getExamples() {
+       protected function getExamplesMessages() {
                return array(
-                       'api.php?action=query&list=prefixsearch&pssearch=meaning',
+                       'action=query&list=prefixsearch&pssearch=meaning'
+                               => 'apihelp-query+prefixsearch-example-simple',
                );
        }