From 370e83bb0dfd0c70de268c93bf07ad5ee0897192 Mon Sep 17 00:00:00 2001 From: Pierre Schmitz Date: Fri, 15 Aug 2008 01:29:47 +0200 Subject: Update auf 1.13.0 --- includes/api/ApiQuerySearch.php | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) (limited to 'includes/api/ApiQuerySearch.php') diff --git a/includes/api/ApiQuerySearch.php b/includes/api/ApiQuerySearch.php index b15f36ce..84a2ec63 100644 --- a/includes/api/ApiQuerySearch.php +++ b/includes/api/ApiQuerySearch.php @@ -30,8 +30,8 @@ if (!defined('MEDIAWIKI')) { /** * Query module to perform full text search within wiki titles and content - * - * @addtogroup API + * + * @ingroup API */ class ApiQuerySearch extends ApiQueryGeneratorBase { @@ -52,7 +52,7 @@ class ApiQuerySearch extends ApiQueryGeneratorBase { $params = $this->extractRequestParams(); $limit = $params['limit']; - $query = $params['search']; + $query = $params['search']; if (is_null($query) || empty($query)) $this->dieUsage("empty search string is not allowed", 'param-search'); @@ -60,11 +60,14 @@ class ApiQuerySearch extends ApiQueryGeneratorBase { $search->setLimitOffset( $limit+1, $params['offset'] ); $search->setNamespaces( $params['namespace'] ); $search->showRedirects = $params['redirects']; - + if ($params['what'] == 'text') $matches = $search->searchText( $query ); else $matches = $search->searchTitle( $query ); + if (is_null($matches)) + $this->dieUsage("{$params['what']} search is disabled", + "search-{$params['what']}-disabled"); $data = array (); $count = 0; @@ -75,6 +78,9 @@ class ApiQuerySearch extends ApiQueryGeneratorBase { break; } + // Silently skip broken titles + if ($result->isBrokenTitle()) continue; + $title = $result->getTitle(); if (is_null($resultPageSet)) { $data[] = array( @@ -100,7 +106,7 @@ class ApiQuerySearch extends ApiQueryGeneratorBase { 'namespace' => array ( ApiBase :: PARAM_DFLT => 0, ApiBase :: PARAM_TYPE => 'namespace', - ApiBase :: PARAM_ISMULTI => true, + ApiBase :: PARAM_ISMULTI => true, ), 'what' => array ( ApiBase :: PARAM_DFLT => 'title', @@ -145,7 +151,6 @@ class ApiQuerySearch extends ApiQueryGeneratorBase { } public function getVersion() { - return __CLASS__ . ': $Id: ApiQuerySearch.php 30222 2008-01-28 19:05:26Z catrope $'; + return __CLASS__ . ': $Id: ApiQuerySearch.php 35098 2008-05-20 17:13:28Z ialex $'; } } - -- cgit v1.2.2