summaryrefslogtreecommitdiffstats
path: root/Bugzilla
diff options
context:
space:
mode:
authorByron Jones <bjones@mozilla.com>2013-05-21 07:59:34 +0200
committerByron Jones <bjones@mozilla.com>2013-05-21 07:59:34 +0200
commita2062da6482fa958a58a7891fc528376c3618be1 (patch)
tree4471c05fc32f302ff6006be599048a2957982ddd /Bugzilla
parent09a62c23f05df3caacd2745d276b846a326be904 (diff)
parent0b1e410c81430711a602adc56e4fc7667d1c841e (diff)
downloadbugzilla-a2062da6482fa958a58a7891fc528376c3618be1.tar.gz
bugzilla-a2062da6482fa958a58a7891fc528376c3618be1.tar.xz
merge with bugzilla/4.2
Diffstat (limited to 'Bugzilla')
-rw-r--r--Bugzilla/Search.pm6
-rw-r--r--Bugzilla/Search/Clause.pm36
-rw-r--r--Bugzilla/Search/Condition.pm9
-rw-r--r--Bugzilla/Search/Quicksearch.pm11
4 files changed, 39 insertions, 23 deletions
diff --git a/Bugzilla/Search.pm b/Bugzilla/Search.pm
index f3b698d0d..a27d3fe64 100644
--- a/Bugzilla/Search.pm
+++ b/Bugzilla/Search.pm
@@ -780,7 +780,7 @@ sub _sql {
my ($self) = @_;
return $self->{sql} if $self->{sql};
my $dbh = Bugzilla->dbh;
-
+
my ($joins, $clause) = $self->_charts_to_conditions();
if (!$clause->as_string
@@ -2485,9 +2485,9 @@ sub _content_matches {
my ($chart_id, $joins, $fields, $operator, $value) =
@$args{qw(chart_id joins fields operator value)};
my $dbh = Bugzilla->dbh;
-
+
# "content" is an alias for columns containing text for which we
- # can search a full-text index and retrieve results by relevance,
+ # can search a full-text index and retrieve results by relevance,
# currently just bug comments (and summaries to some degree).
# There's only one way to search a full-text index, so we only
# accept the "matches" operator, which is specific to full-text
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/Condition.pm b/Bugzilla/Search/Condition.pm
index 2268da197..167b4f01e 100644
--- a/Bugzilla/Search/Condition.pm
+++ b/Bugzilla/Search/Condition.pm
@@ -32,9 +32,16 @@ sub new {
}
sub field { return $_[0]->{field} }
-sub operator { return $_[0]->{operator} }
sub value { return $_[0]->{value} }
+sub operator {
+ my ($self, $value) = @_;
+ if (@_ == 2) {
+ $self->{operator} = $value;
+ }
+ return $self->{operator};
+}
+
sub fov {
my ($self) = @_;
return ($self->field, $self->operator, $self->value);
diff --git a/Bugzilla/Search/Quicksearch.pm b/Bugzilla/Search/Quicksearch.pm
index 1fca2e322..61e4a926a 100644
--- a/Bugzilla/Search/Quicksearch.pm
+++ b/Bugzilla/Search/Quicksearch.pm
@@ -382,9 +382,14 @@ sub _handle_field_names {
# Flag and requestee shortcut
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);
+ my ($flagtype, $requestee) = ($1, $2);
+ addChart('flagtypes.name', 'substring', $flagtype, $negate);
+ if ($requestee) {
+ # AND
+ $chart++;
+ $and = $or = 0;
+ addChart('requestees.login_name', 'substring', $requestee, $negate);
+ }
return 1;
}