summaryrefslogtreecommitdiffstats
path: root/Bugzilla/Search
diff options
context:
space:
mode:
authorByron Jones <bjones@mozilla.com>2013-04-17 19:15:46 +0200
committerByron Jones <bjones@mozilla.com>2013-04-17 19:15:46 +0200
commitcd2776192dbaf1d21353f400eaf42d01e66b33f4 (patch)
tree18de730e2b1c4394eaacfdca8e468e4cf8e8d169 /Bugzilla/Search
parent5151736ba38fb79a811972960753313691226928 (diff)
downloadbugzilla-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')
-rw-r--r--Bugzilla/Search/Clause.pm38
-rw-r--r--Bugzilla/Search/Quicksearch.pm4
2 files changed, 22 insertions, 20 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
diff --git a/Bugzilla/Search/Quicksearch.pm b/Bugzilla/Search/Quicksearch.pm
index fc109a640..d073720a1 100644
--- a/Bugzilla/Search/Quicksearch.pm
+++ b/Bugzilla/Search/Quicksearch.pm
@@ -364,10 +364,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;
}