Ram has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/57368


Change subject: Bug: 43544: Propagate lucene errors back up to user.
......................................................................

Bug: 43544: Propagate lucene errors back up to user.

When lsearchd returns 500 errors, they get propagated back to user.

Bug: 43544
Change-Id: Ic07ce8f32be8358fbb2f5a60f3c8c324cb27694c
---
M includes/specials/SpecialSearch.php
M languages/messages/MessagesEn.php
M maintenance/language/messages.inc
3 files changed, 13 insertions(+), 4 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/68/57368/1

diff --git a/includes/specials/SpecialSearch.php 
b/includes/specials/SpecialSearch.php
index 380e20e..9c7467f 100644
--- a/includes/specials/SpecialSearch.php
+++ b/includes/specials/SpecialSearch.php
@@ -258,7 +258,7 @@
                }
 
                // did you mean... suggestions
-               if( $textMatches && $textMatches->hasSuggestion() ) {
+               if( $textMatches && $textMatches->hasSuggestion() && 
!$textMatches->errMsg() ) {
                        $st = SpecialPage::getTitleFor( 'Search' );
 
                        # mirror Go/Search behavior of original request ..
@@ -381,7 +381,7 @@
                        }
                        $titleMatches->free();
                }
-               if( $textMatches ) {
+               if( $textMatches && !$textMatches->errMsg() ) {
                        // output appropriate heading
                        if( $numTextMatches > 0 && $numTitleMatches > 0 ) {
                                // if no title matches the heading is redundant
@@ -402,8 +402,15 @@
                        $textMatches->free();
                }
                if( $num === 0 ) {
-                       $out->wrapWikiMsg( "<p 
class=\"mw-search-nonefound\">\n$1</p>", array( 'search-nonefound', 
wfEscapeWikiText( $term ) ) );
-                       $this->showCreateLink( $t );
+                       $fmt = "<p class=\"mw-search-nonefound\">\n$1</p>";
+                       $sTerm = wfEscapeWikiText( $term );
+                       if ( $textMatches && $textMatches->errMsg() ) {
+                               $out->wrapWikiMsg( $fmt, array( 'search-error', 
$sTerm ) );
+                               $out->addWikiText( '<div class="error">' . 
$textMatches->errMsg() . '</div>' );
+                       } else {
+                               $out->wrapWikiMsg( $fmt, array( 
'search-nonefound', $sTerm ) );
+                               $this->showCreateLink( $t );
+                       }
                }
                $out->addHtml( "</div>" );
 
diff --git a/languages/messages/MessagesEn.php 
b/languages/messages/MessagesEn.php
index 44b6cc9..4aa88c6 100644
--- a/languages/messages/MessagesEn.php
+++ b/languages/messages/MessagesEn.php
@@ -1775,6 +1775,7 @@
 'showingresultsheader'             => "{{PLURAL:$5|Result '''$1''' of 
'''$3'''|Results '''$1 - $2''' of '''$3'''}} for '''$4'''",
 'nonefound'                        => "'''Note:''' Only some namespaces are 
searched by default.
 Try prefixing your query with ''all:'' to search all content (including talk 
pages, templates, etc), or use the desired namespace as prefix.",
+'search-error'                     => 'Internal search error; please try again 
later.',
 'search-nonefound'                 => 'There were no results matching the 
query.',
 'powersearch'                      => 'Advanced search',
 'powersearch-legend'               => 'Advanced search',
diff --git a/maintenance/language/messages.inc 
b/maintenance/language/messages.inc
index 9c883bf..66ebc62 100644
--- a/maintenance/language/messages.inc
+++ b/maintenance/language/messages.inc
@@ -931,6 +931,7 @@
                'showingresultsnum',
                'showingresultsheader',
                'nonefound',
+               'search-error',
                'search-nonefound',
                'powersearch',
                'powersearch-legend',

-- 
To view, visit https://gerrit.wikimedia.org/r/57368
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ic07ce8f32be8358fbb2f5a60f3c8c324cb27694c
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Ram <r...@wikimedia.org>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to