From df1f6c934e34a06298d70c89f4a0e343ea6ac9d2 Mon Sep 17 00:00:00 2001 From: David Lawrence Date: Fri, 28 Aug 2015 14:29:38 +0000 Subject: Bug 1195362: Quicksearch error pages ("foo is not a field" and friends) should still fill in search into quicksearch box --- Bugzilla/Search/Quicksearch.pm | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) (limited to 'Bugzilla') diff --git a/Bugzilla/Search/Quicksearch.pm b/Bugzilla/Search/Quicksearch.pm index e601b4f24..c65fe06a8 100644 --- a/Bugzilla/Search/Quicksearch.pm +++ b/Bugzilla/Search/Quicksearch.pm @@ -165,10 +165,12 @@ sub quicksearch { # If parse_line() returns no data, this means strings are badly quoted. # Rather than trying to guess what the user wanted to do, we throw an error. scalar(@words) - || ThrowUserError('quicksearch_unbalanced_quotes', {string => $searchstring}); + || ThrowUserError('quicksearch_unbalanced_quotes', + { string => $searchstring, quicksearch => $searchstring }); # A query cannot start with AND or OR, nor can it end with AND, OR or NOT. - ThrowUserError('quicksearch_invalid_query') + ThrowUserError('quicksearch_invalid_query', + { quicksearch => $searchstring }) if ($words[0] =~ /^(?:AND|OR)$/ || $words[$#words] =~ /^(?:AND|OR|NOT)$/); $fulltext = Bugzilla->user->setting('quicksearch_fulltext') eq 'on' ? 1 : 0; @@ -179,13 +181,15 @@ sub quicksearch { # AND is the default word separator, similar to a whitespace, # but |a AND OR b| is not a valid combination. if ($word eq 'AND') { - ThrowUserError('quicksearch_invalid_query', {operators => ['AND', 'OR']}) + ThrowUserError('quicksearch_invalid_query', + { operators => ['AND', 'OR'], quicksearch => $searchstring }) if $words[0] eq 'OR'; } # |a OR AND b| is not a valid combination. # |a OR OR b| is equivalent to |a OR b| and so is harmless. elsif ($word eq 'OR') { - ThrowUserError('quicksearch_invalid_query', {operators => ['OR', 'AND']}) + ThrowUserError('quicksearch_invalid_query', + { operators => ['OR', 'AND'], quicksearch => $searchstring }) if $words[0] eq 'AND'; } # NOT negates the following word. @@ -195,7 +199,8 @@ sub quicksearch { $word = shift @words; next if $word eq 'NOT'; if ($word eq 'AND' || $word eq 'OR') { - ThrowUserError('quicksearch_invalid_query', {operators => ['NOT', $word]}); + ThrowUserError('quicksearch_invalid_query', + { operators => ['NOT', $word], quicksearch => $searchstring }); } unshift(@words, "-$word"); } @@ -259,8 +264,9 @@ sub quicksearch { # Inform user about any unknown fields if (scalar(@unknownFields) || scalar(keys %ambiguous_fields)) { ThrowUserError("quicksearch_unknown_field", - { unknown => \@unknownFields, - ambiguous => \%ambiguous_fields }); + { unknown => \@unknownFields, + ambiguous => \%ambiguous_fields, + quicksearch => $searchstring }); } # Make sure we have some query terms left -- cgit v1.2.3-24-g4f1b