summaryrefslogtreecommitdiff
path: root/includes/api/ApiQuerySearch.php
diff options
context:
space:
mode:
Diffstat (limited to 'includes/api/ApiQuerySearch.php')
-rw-r--r--includes/api/ApiQuerySearch.php19
1 files changed, 12 insertions, 7 deletions
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 $';
}
}
-