Fix for r99911: don't use getImageArea() to determine the area for comparison against...
[lhc/web/wiklou.git] / includes / api / ApiQuerySearch.php
index 84f547e..a7e0974 100644 (file)
  * @file
  */
 
-if ( !defined( 'MEDIAWIKI' ) ) {
-       // Eclipse helper - will be ignored in production
-       require_once( 'ApiQueryBase.php' );
-}
-
 /**
  * Query module to perform full text search within wiki titles and content
  *
@@ -69,6 +64,9 @@ class ApiQuerySearch extends ApiQueryGeneratorBase {
                $search->setNamespaces( $params['namespace'] );
                $search->showRedirects = $params['redirects'];
 
+               $query = $search->transformSearchTerm( $query );
+               $query = $search->replacePrefixes( $query );
+
                // Perform the actual search
                if ( $what == 'text' ) {
                        $matches = $search->searchText( $query );
@@ -126,6 +124,7 @@ class ApiQuerySearch extends ApiQueryGeneratorBase {
 
                        // Silently skip broken and missing titles
                        if ( $result->isBrokenTitle() || $result->isMissingRevision() ) {
+                               $result = $matches->next();
                                continue;
                        }
 
@@ -269,10 +268,10 @@ class ApiQuerySearch extends ApiQueryGeneratorBase {
                                ' score            - Adds the score (if any) from the search engine',
                                ' snippet          - Adds a parsed snippet of the page',
                                ' titlesnippet     - Adds a parsed snippet of the page title',
-                               ' redirectsnippet  - Adds a parsed snippet of the redirect',
-                               ' redirecttitle    - Adds a parsed snippet of the redirect title',
-                               ' sectionsnippet   - Adds a parsed snippet of the matching section',
-                               ' sectiontitle     - Adds a parsed snippet of the matching section title',
+                               ' redirectsnippet  - Adds a parsed snippet of the redirect title',
+                               ' redirecttitle    - Adds the title of the matching redirect',
+                               ' sectionsnippet   - Adds a parsed snippet of the matching section title',
+                               ' sectiontitle     - Adds the title of the matching section',
                                ' hasrelated       - Indicates whether a related search is available',
                        ),
                        'redirects' => 'Include redirect pages in the search',
@@ -292,7 +291,7 @@ class ApiQuerySearch extends ApiQueryGeneratorBase {
                ) );
        }
 
-       protected function getExamples() {
+       public function getExamples() {
                return array(
                        'api.php?action=query&list=search&srsearch=meaning',
                        'api.php?action=query&list=search&srwhat=text&srsearch=meaning',
@@ -300,6 +299,10 @@ class ApiQuerySearch extends ApiQueryGeneratorBase {
                );
        }
 
+       public function getHelpUrls() {
+               return 'http://www.mediawiki.org/wiki/API:Search';
+       }
+
        public function getVersion() {
                return __CLASS__ . ': $Id$';
        }