Commit 6aad3a09 authored by David Lawrence's avatar David Lawrence

Bug 580490 - Quicksearch should optionally not search comments

r/a=mkanat
parent 8cef0a14
...@@ -88,6 +88,8 @@ sub SETTINGS { ...@@ -88,6 +88,8 @@ sub SETTINGS {
default => 'before_comments' }, default => 'before_comments' },
# 2008-08-27 LpSolit@gmail.com -- Bug 182238 # 2008-08-27 LpSolit@gmail.com -- Bug 182238
timezone => { subclass => 'Timezone', default => 'local' }, timezone => { subclass => 'Timezone', default => 'local' },
# 2011-02-07 dkl@mozilla.com -- Bug 580490
quicksearch_fulltext => { options => ['on', 'off'], default => 'on' },
} }
}; };
......
...@@ -128,7 +128,7 @@ use constant COMPONENT_EXCEPTIONS => ( ...@@ -128,7 +128,7 @@ use constant COMPONENT_EXCEPTIONS => (
); );
# Quicksearch-wide globals for boolean charts. # Quicksearch-wide globals for boolean charts.
our ($chart, $and, $or); our ($chart, $and, $or, $fulltext);
sub quicksearch { sub quicksearch {
my ($searchstring) = (@_); my ($searchstring) = (@_);
...@@ -142,6 +142,8 @@ sub quicksearch { ...@@ -142,6 +142,8 @@ sub quicksearch {
$searchstring =~ s/(^[\s,]+|[\s,]+$)//g; $searchstring =~ s/(^[\s,]+|[\s,]+$)//g;
ThrowUserError('buglist_parameters_required') unless ($searchstring); ThrowUserError('buglist_parameters_required') unless ($searchstring);
$fulltext = Bugzilla->user->settings->{'quicksearch_fulltext'}->{'value'} eq 'on' ? 1 : 0;
if ($searchstring =~ m/^[0-9,\s]*$/) { if ($searchstring =~ m/^[0-9,\s]*$/) {
_bug_numbers_only($searchstring); _bug_numbers_only($searchstring);
} }
...@@ -317,7 +319,7 @@ sub _handle_special_first_chars { ...@@ -317,7 +319,7 @@ sub _handle_special_first_chars {
if ($firstChar eq '#') { if ($firstChar eq '#') {
addChart('short_desc', 'substring', $baseWord, $negate); addChart('short_desc', 'substring', $baseWord, $negate);
addChart('content', 'matches', _matches_phrase($baseWord), $negate); addChart('content', 'matches', _matches_phrase($baseWord), $negate) if $fulltext;
return 1; return 1;
} }
if ($firstChar eq ':') { if ($firstChar eq ':') {
...@@ -489,7 +491,7 @@ sub _default_quicksearch_word { ...@@ -489,7 +491,7 @@ sub _default_quicksearch_word {
addChart('alias', 'substring', $word, $negate); addChart('alias', 'substring', $word, $negate);
addChart('short_desc', 'substring', $word, $negate); addChart('short_desc', 'substring', $word, $negate);
addChart('status_whiteboard', 'substring', $word, $negate); addChart('status_whiteboard', 'substring', $word, $negate);
addChart('content', 'matches', _matches_phrase($word), $negate); addChart('content', 'matches', _matches_phrase($word), $negate) if $fulltext;
} }
sub _handle_urls { sub _handle_urls {
......
...@@ -48,6 +48,7 @@ ...@@ -48,6 +48,7 @@
"after_comments" => "After other comments", "after_comments" => "After other comments",
"timezone" => "Timezone used to display dates and times", "timezone" => "Timezone used to display dates and times",
"local" => "Same as the server", "local" => "Same as the server",
"quicksearch_fulltext" => "Include comments when performing quick searches (slower)",
} }
%] %]
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment