diff options
author | Byron Jones <bjones@mozilla.com> | 2013-04-23 16:26:34 +0200 |
---|---|---|
committer | Byron Jones <bjones@mozilla.com> | 2013-04-23 16:26:34 +0200 |
commit | 943cf01c431b8ae1e4180be2303041f54867f5b0 (patch) | |
tree | 6266d66d8992512fb98f2dde9c942bf69190c893 /Bugzilla/Search/Clause.pm | |
parent | a2e6439211e3db08bbb2a2cfe1b391b3ff907b47 (diff) | |
download | bugzilla-943cf01c431b8ae1e4180be2303041f54867f5b0.tar.gz bugzilla-943cf01c431b8ae1e4180be2303041f54867f5b0.tar.xz |
Bug 828344: "contains all of the words" no longer looks for all words within the same comment or flag
Diffstat (limited to 'Bugzilla/Search/Clause.pm')
-rw-r--r-- | Bugzilla/Search/Clause.pm | 36 |
1 files changed, 20 insertions, 16 deletions
diff --git a/Bugzilla/Search/Clause.pm b/Bugzilla/Search/Clause.pm index 38f6f30be..89210babb 100644 --- a/Bugzilla/Search/Clause.pm +++ b/Bugzilla/Search/Clause.pm @@ -98,25 +98,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 |