Demon has uploaded a new change for review.
https://gerrit.wikimedia.org/r/57336
Change subject: Allow search backends to return statuses instead of result sets
......................................................................
Allow search backends to return statuses instead of result sets
This will allow a backend to propogate more useful errors up
the stack.
Change-Id: I54ab520762381e8f46d5ca17c0bad8820eacb964
---
M includes/specials/SpecialSearch.php
M languages/messages/MessagesEn.php
M maintenance/language/messages.inc
3 files changed, 14 insertions(+), 1 deletion(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core
refs/changes/36/57336/1
diff --git a/includes/specials/SpecialSearch.php
b/includes/specials/SpecialSearch.php
index 380e20e..24d8927 100644
--- a/includes/specials/SpecialSearch.php
+++ b/includes/specials/SpecialSearch.php
@@ -254,7 +254,18 @@
$titleMatches = $search->searchTitle( $rewritten );
if( !( $titleMatches instanceof SearchResultTooMany ) ) {
- $textMatches = $search->searchText( $rewritten );
+ $textMatches = $search->searchText(
SpecialPage::getTitleFor( 'Search' ) );
+ }
+
+ if( $titleMatches instanceof Status ) {
+ wfProfileOut( __METHOD__ );
+ throw new ErrorPageError( $this->getTitle(),
'search-error',
+ $titleMatches->getWikiText() );
+ }
+ if( $textMatches instanceof Status ) {
+ wfProfileOut( __METHOD__ );
+ throw new ErrorPageError( $this->getTitle(),
'search-error',
+ $textMatches->getWikiText() );
}
// did you mean... suggestions
diff --git a/languages/messages/MessagesEn.php
b/languages/messages/MessagesEn.php
index 44b6cc9..d13b61d 100644
--- a/languages/messages/MessagesEn.php
+++ b/languages/messages/MessagesEn.php
@@ -1804,6 +1804,7 @@
# OpenSearch description
'opensearch-desc' => '{{SITENAME}} ({{CONTENTLANGUAGE}})', # do not translate
or duplicate this message to other languages
+'search-error' => 'An error has occurred while searching: $1',
# Quickbar
'qbsettings' => 'Quickbar',
diff --git a/maintenance/language/messages.inc
b/maintenance/language/messages.inc
index 9c883bf..1b02ab2 100644
--- a/maintenance/language/messages.inc
+++ b/maintenance/language/messages.inc
@@ -943,6 +943,7 @@
'search-external',
'searchdisabled',
'googlesearch',
+ 'search-error',
),
'opensearch' => array(
'opensearch-desc',
--
To view, visit https://gerrit.wikimedia.org/r/57336
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I54ab520762381e8f46d5ca17c0bad8820eacb964
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Demon <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits