summaryrefslogtreecommitdiffstats
path: root/Bugzilla/Search
diff options
context:
space:
mode:
authorByron Jones <bjones@mozilla.com>2013-04-23 16:26:34 +0200
committerByron Jones <bjones@mozilla.com>2013-04-23 16:26:34 +0200
commit943cf01c431b8ae1e4180be2303041f54867f5b0 (patch)
tree6266d66d8992512fb98f2dde9c942bf69190c893 /Bugzilla/Search
parenta2e6439211e3db08bbb2a2cfe1b391b3ff907b47 (diff)
downloadbugzilla-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')
-rw-r--r--Bugzilla/Search/Clause.pm36
-rw-r--r--Bugzilla/Search/Quicksearch.pm4
2 files changed, 21 insertions, 19 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
diff --git a/Bugzilla/Search/Quicksearch.pm b/Bugzilla/Search/Quicksearch.pm
index 215cc842e..92aaf7fb0 100644
--- a/Bugzilla/Search/Quicksearch.pm
+++ b/Bugzilla/Search/Quicksearch.pm
@@ -381,10 +381,8 @@ sub _handle_field_names {
my ($or_operand, $negate, $unknownFields, $ambiguous_fields) = @_;
# Flag and requestee shortcut
- if ($or_operand =~ /^(?:flag:)?([^\?]+\?)([^\?]*)$/) {
+ 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);
return 1;
}