From 16755e7fd31d4a94c0d84fde72e55dcb020d6531 Mon Sep 17 00:00:00 2001 From: Roan Kattouw Date: Wed, 3 Dec 2008 19:33:57 +0000 Subject: [PATCH] API: (bug 16548) list=search threw invalid errors under certain circumstances --- RELEASE-NOTES | 1 + includes/api/ApiQuerySearch.php | 5 ++++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 73b645e087..3c1d546bb5 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -488,6 +488,7 @@ The following extensions are migrated into MediaWiki 1.14: instead of spaces * (bug 16516) Made rvsection=T-2 work * (bug 16526) Added usprop=canemail to list=users +* (bug 16548) list=search threw errors with an invalid error code === Languages updated in 1.14 === diff --git a/includes/api/ApiQuerySearch.php b/includes/api/ApiQuerySearch.php index 639079c2d5..f79e3a098e 100644 --- a/includes/api/ApiQuerySearch.php +++ b/includes/api/ApiQuerySearch.php @@ -71,14 +71,17 @@ class ApiQuerySearch extends ApiQueryGeneratorBase { // of the way we initially set up the MySQL fulltext-based // search engine with separate title and text fields. // In the future, the default should be for a combined index. + $what = 'title'; $matches = $search->searchTitle( $query ); // Not all search engines support a separate title search, // for instance the Lucene-based engine we use on Wikipedia. // In this case, fall back to full-text search (which will // include titles in it!) - if( is_null( $matches ) ) + if( is_null( $matches ) ) { + $what = 'text'; $matches = $search->searchText( $query ); + } } if (is_null($matches)) $this->dieUsage("{$what} search is disabled", -- 2.20.1