diff options
author | Byron Jones <bjones@mozilla.com> | 2013-04-17 19:15:46 +0200 |
---|---|---|
committer | Byron Jones <bjones@mozilla.com> | 2013-04-17 19:15:46 +0200 |
commit | cd2776192dbaf1d21353f400eaf42d01e66b33f4 (patch) | |
tree | 18de730e2b1c4394eaacfdca8e468e4cf8e8d169 /Bugzilla/Search/Clause.pm | |
parent | 5151736ba38fb79a811972960753313691226928 (diff) | |
download | bugzilla-cd2776192dbaf1d21353f400eaf42d01e66b33f4.tar.gz bugzilla-cd2776192dbaf1d21353f400eaf42d01e66b33f4.tar.xz |
Bug 828344: Make "contains all of the words" look for all words within the same comment or flag
r=LpSolit, a=LpSolit
Diffstat (limited to 'Bugzilla/Search/Clause.pm')
-rw-r--r-- | Bugzilla/Search/Clause.pm | 38 |
1 files changed, 21 insertions, 17 deletions
diff --git a/Bugzilla/Search/Clause.pm b/Bugzilla/Search/Clause.pm index 7bfd52015..9d3d690a3 100644 --- a/Bugzilla/Search/Clause.pm +++ b/Bugzilla/Search/Clause.pm @@ -86,25 +86,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; - - my $string = $child->as_string; - if ($self->joiner eq 'AND') { - $string = "( $string )" if $string =~ /OR/; - } - else { - $string = "( $string )" if $string =~ /AND/; + 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; + 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 |