jenkins-bot has submitted this change and it was merged.

Change subject: Add error messages for pool queue full
......................................................................


Add error messages for pool queue full

These error messages tell the user that that are too many concurrent queries
or too many concurrent _regex_ queries so its more clear what is up.

Change-Id: I19270803badeb2bcfe46077f41dbcdbac42b389f
---
M i18n/en.json
M i18n/qqq.json
M includes/Searcher.php
3 files changed, 11 insertions(+), 1 deletion(-)

Approvals:
  Chad: Looks good to me, approved
  Siebrand: Looks good to me, but someone else must approve
  jenkins-bot: Verified



diff --git a/i18n/en.json b/i18n/en.json
index 74a009b..396cec6 100644
--- a/i18n/en.json
+++ b/i18n/en.json
@@ -5,7 +5,9 @@
        "cirrussearch-desc": "Elasticsearch-powered search for MediaWiki",
        "cirrussearch-backend-error": "We could not complete your search due to 
a temporary problem. Please try again later.",
        "cirrussearch-parse-error": "Query was not understood. Please make it 
simpler. The query was logged to improve the search system.",
+       "cirrussearch-too-busy-error": "Search is currently too busy.  Please 
try again later.",
        "cirrussearch-regex-syntax-error": "Regular expression syntax error at 
$2: $1",
+       "cirrussearch-regex-too-busy-error": "Too many regular expression 
searches currently running.  Please try again later.",
        "cirrussearch-now-using": "This wiki is using a new search engine. 
([[mw:Special:MyLanguage/Help:CirrusSearch|Learn more]])",
        "cirrussearch-ignored-headings": " #<!-- leave this line exactly as it 
is --> <pre>\n# Headings that will be ignored by search.\n# Changes to this 
take effect as soon as the page with the heading is indexed.\n# You can force 
page reindexing by doing a null edit.\n# Syntax is as follows:\n#   * 
Everything from a \"#\" character to the end of the line is a comment.\n#   * 
Every non-blank line is the exact title to ignore, case and 
everything.\nReferences\nExternal links\nSee also\n #</pre> <!-- leave this 
line exactly as it is -->",
        "cirrussearch-boost-templates": " #<!-- leave this line exactly as it 
is --> <pre>\n# If a page contains one of these templates then its search score 
is multiplied by the configured percentage.\n# Changes to this take effect 
immediately.\n# Syntax is as follows:\n#   * Everything from a \"#\" character 
to the end of the line is a comment.\n#   * Every non-blank line is the exact 
template name to boost, namespace, case and everything, followed by a \"|\" 
character followed by a number followed by a \"%\" character.\n# Examples of 
good lines:\n# Template:Good|150%\n# Template:Very Very Good|300%\n# 
Template:Bad|50%\n# Examples of non-working lines:\n# Template:Foo|150.234234% 
<-- no decimal points allowed!\n# Foo|150% <--- technically works, but for 
transclusions of the Foo page from the main namespace\n# You can test 
configuration changes by performing a query prefixed with 
boost-templates:\"XX\" where XX is all of the templates you want to boost 
separated by spaces instead of line breaks.\n# Queries that specify 
boost-templates:\"XX\" ignore the contents of this field.\n #</pre> <!-- leave 
this line exactly as it is -->",
diff --git a/i18n/qqq.json b/i18n/qqq.json
index cdfec01..114c91c 100644
--- a/i18n/qqq.json
+++ b/i18n/qqq.json
@@ -10,7 +10,9 @@
        "cirrussearch-desc": "{{desc|name=Cirrus 
Search|url=http://www.mediawiki.org/wiki/Extension:CirrusSearch}}\n\"Elasticsearch\";
 is a full-text search engine. See http://www.elasticsearch.org/";,
        "cirrussearch-backend-error": "Error message shown to the users when we 
have an issue communicating with our search backend",
        "cirrussearch-parse-error": "Error message shown to the users when we 
couldn't understand the query.  For the most part we don't expect users to see 
this because we retry retry queries that we don't unserstand using a 
(hopefully) fail safe method.",
+       "cirrussearch-too-busy-error": "Error message shown to the users when 
there are too many concurrent searches currently running and we can't allow any 
more to start.",
        "cirrussearch-regex-syntax-error": "Error message shown to users 
attempting to use a [[w:Regular expression|regular expression]] query with 
invalid syntax.\n\nParameters:\n* $1 - error message\n* $2 - number of 
characters (position), or \"unknown\" (hard-coded string)",
+       "cirrussearch-regex-too-busy-error": "Error message shown to the users 
when they attempt a regular expression search and there are too many concurrent 
regular expression searches currently running and we can't allow any more to 
start.",
        "cirrussearch-now-using": "Note that this wiki is using a new search 
engine with a link for people to learn more.  That'll contain information on 
filing a bug, new syntax, etc.",
        "cirrussearch-ignored-headings": "Headings that will be ignored by 
search. You can translate the text, including \"Leave this line exactly as it 
is\". Some lines of this messages have one (1) leading space.",
        "cirrussearch-boost-templates": "Templates that if contained on a page 
will raise or lower the score of the page in search results.  They must be 
specied Namespace:Template Name|<boost factor>%. You can translate the text, 
including \"Leave this line exactly as it is\". Some lines of this messages 
have one (1) leading space. \n\nThis message will be shown with left-to-right 
direction, so when you are translating to a right-to-left language, you may 
want to test how it looks in left-to-right and add right-to-left marks as 
needed.",
diff --git a/includes/Searcher.php b/includes/Searcher.php
index bd78012..5fe5af5 100644
--- a/includes/Searcher.php
+++ b/includes/Searcher.php
@@ -1020,9 +1020,15 @@
                                        return $searcher->failure( $e );
                                }
                        },
-                       'error' => function( $status ) use ( $key, $description 
) {
+                       'error' => function( $status ) use ( $type, $key, 
$description ) {
                                $status = $status->getErrorsArray();
                                wfLogWarning( "Elasticsearch pool error on key 
$key during $description:  " . $status[ 0 ][ 0 ] );
+                               if ( $status[ 0 ][ 0 ] === 'pool-queuefull' ) {
+                                       if ( $type === 'regex' ) {
+                                               return Status::newFatal( 
'cirrussearch-regex-too-busy-error' );
+                                       }
+                                       return Status::newFatal( 
'cirrussearch-too-busy-error' );
+                               }
                                return Status::newFatal( 
'cirrussearch-backend-error' );
                        }
                ) );

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I19270803badeb2bcfe46077f41dbcdbac42b389f
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/CirrusSearch
Gerrit-Branch: master
Gerrit-Owner: Manybubbles <[email protected]>
Gerrit-Reviewer: Chad <[email protected]>
Gerrit-Reviewer: Siebrand <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to