summaryrefslogtreecommitdiffstats
path: root/Bugzilla/Search/Clause.pm
diff options
context:
space:
mode:
authorByron Jones <bjones@mozilla.com>2013-05-20 19:54:06 +0200
committerByron Jones <bjones@mozilla.com>2013-05-20 19:54:06 +0200
commit0b1e410c81430711a602adc56e4fc7667d1c841e (patch)
treea538bc9da4cef2440a16e5f64c634daa6e8c1305 /Bugzilla/Search/Clause.pm
parent1f7cfaeb0ce976e5f7ec4ec9b8b02c47cd01b45e (diff)
downloadbugzilla-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/Clause.pm')
-rw-r--r--Bugzilla/Search/Clause.pm36
1 files changed, 20 insertions, 16 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