diff options
author | Byron Jones <bjones@mozilla.com> | 2013-05-20 19:54:06 +0200 |
---|---|---|
committer | Byron Jones <bjones@mozilla.com> | 2013-05-20 19:54:06 +0200 |
commit | 0b1e410c81430711a602adc56e4fc7667d1c841e (patch) | |
tree | a538bc9da4cef2440a16e5f64c634daa6e8c1305 /Bugzilla/Search | |
parent | 1f7cfaeb0ce976e5f7ec4ec9b8b02c47cd01b45e (diff) | |
download | bugzilla-0b1e410c81430711a602adc56e4fc7667d1c841e.tar.gz bugzilla-0b1e410c81430711a602adc56e4fc7667d1c841e.tar.xz |
Bug 828344: "contains all of the words" no longer looks for all words within the same comment or flag
r=LpSolit, a=LpSolit
Diffstat (limited to 'Bugzilla/Search')
-rw-r--r-- | Bugzilla/Search/Clause.pm | 36 | ||||
-rw-r--r-- | Bugzilla/Search/Condition.pm | 9 | ||||
-rw-r--r-- | Bugzilla/Search/Quicksearch.pm | 11 |
3 files changed, 36 insertions, 20 deletions
diff --git a/Bugzilla/Search/Clause.pm b/Bugzilla/Search/Clause.pm index a068ce5ed..5f5ea5b50 100644 --- a/Bugzilla/Search/Clause.pm +++ b/Bugzilla/Search/Clause.pm @@ -93,25 +93,29 @@ sub walk_conditions { sub as_string { my ($self) = @_; - my @strings; - foreach my $child (@{ $self->children }) { - next if $child->isa(__PACKAGE__) && !$child->has_translated_conditions; - next if $child->isa('Bugzilla::Search::Condition') - && !$child->translated; + if (!$self->{sql}) { + my @strings; + foreach my $child (@{ $self->children }) { + next if $child->isa(__PACKAGE__) && !$child->has_translated_conditions; + next if $child->isa('Bugzilla::Search::Condition') + && !$child->translated; - my $string = $child->as_string; - if ($self->joiner eq 'AND') { - $string = "( $string )" if $string =~ /OR/; - } - else { - $string = "( $string )" if $string =~ /AND/; + my $string = $child->as_string; + next unless $string; + if ($self->joiner eq 'AND') { + $string = "( $string )" if $string =~ /OR/; + } + else { + $string = "( $string )" if $string =~ /AND/; + } + push(@strings, $string); } - push(@strings, $string); + + my $sql = join(' ' . $self->joiner . ' ', @strings); + $sql = "NOT( $sql )" if $sql && $self->negate; + $self->{sql} = $sql; } - - my $sql = join(' ' . $self->joiner . ' ', @strings); - $sql = "NOT( $sql )" if $sql && $self->negate; - return $sql; + return $self->{sql}; } # Search.pm converts URL parameters to Clause objects. This helps do the diff --git a/Bugzilla/Search/Condition.pm b/Bugzilla/Search/Condition.pm index 2268da197..167b4f01e 100644 --- a/Bugzilla/Search/Condition.pm +++ b/Bugzilla/Search/Condition.pm @@ -32,9 +32,16 @@ sub new { } sub field { return $_[0]->{field} } -sub operator { return $_[0]->{operator} } sub value { return $_[0]->{value} } +sub operator { + my ($self, $value) = @_; + if (@_ == 2) { + $self->{operator} = $value; + } + return $self->{operator}; +} + sub fov { my ($self) = @_; return ($self->field, $self->operator, $self->value); diff --git a/Bugzilla/Search/Quicksearch.pm b/Bugzilla/Search/Quicksearch.pm index 7424f831f..fd9d796d1 100644 --- a/Bugzilla/Search/Quicksearch.pm +++ b/Bugzilla/Search/Quicksearch.pm @@ -377,9 +377,14 @@ sub _handle_field_names { # Flag and requestee shortcut if ($or_operand =~ /^(?:flag:)?([^\?]+\?)([^\?]*)$/) { - addChart('flagtypes.name', 'substring', $1, $negate); - $chart++; $and = $or = 0; # Next chart for boolean AND - addChart('requestees.login_name', 'substring', $2, $negate); + my ($flagtype, $requestee) = ($1, $2); + addChart('flagtypes.name', 'substring', $flagtype, $negate); + if ($requestee) { + # AND + $chart++; + $and = $or = 0; + addChart('requestees.login_name', 'substring', $requestee, $negate); + } return 1; } |