* @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
*
$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 );
// Silently skip broken and missing titles
if ( $result->isBrokenTitle() || $result->isMissingRevision() ) {
+ $result = $matches->next();
continue;
}
' 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',
) );
}
- 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',
);
}
+ public function getHelpUrls() {
+ return 'http://www.mediawiki.org/wiki/API:Search';
+ }
+
public function getVersion() {
return __CLASS__ . ': $Id$';
}