summaryrefslogtreecommitdiffstats
path: root/Bugzilla/Search.pm
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.pm
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.pm')
-rw-r--r--Bugzilla/Search.pm84
1 files changed, 72 insertions, 12 deletions
diff --git a/Bugzilla/Search.pm b/Bugzilla/Search.pm
index f0cb26357..4bb74f983 100644
--- a/Bugzilla/Search.pm
+++ b/Bugzilla/Search.pm
@@ -300,7 +300,9 @@ use constant OPERATOR_FIELD_OVERRIDE => {
},
dependson => MULTI_SELECT_OVERRIDE,
keywords => MULTI_SELECT_OVERRIDE,
- 'flagtypes.name' => MULTI_SELECT_OVERRIDE,
+ 'flagtypes.name' => {
+ _non_changed => \&_flagtypes_nonchanged,
+ },
longdesc => {
changedby => \&_long_desc_changedby,
changedbefore => \&_long_desc_changedbefore_after,
@@ -776,8 +778,16 @@ 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
+ && !Bugzilla->params->{'search_allow_no_criteria'}
+ && !$self->{allow_unlimited})
+ {
+ ThrowUserError('buglist_parameters_required');
+ }
+
my $select = join(', ', $self->_sql_select);
my $from = $self->_sql_from($joins);
my $where = $self->_sql_where($clause);
@@ -1279,14 +1289,7 @@ sub _sql_where {
# SQL a bit more readable for debugging.
my $where = join("\n AND ", $self->_standard_where);
my $clause_sql = $main_clause->as_string;
- if ($clause_sql) {
- $where .= "\n AND " . $clause_sql;
- }
- elsif (!Bugzilla->params->{'search_allow_no_criteria'}
- && !$self->{allow_unlimited})
- {
- ThrowUserError('buglist_parameters_required');
- }
+ $where .= "\n AND " . $clause_sql if $clause_sql;
return $where;
}
@@ -2479,9 +2482,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
@@ -2729,6 +2732,63 @@ sub _multiselect_multiple {
}
}
+sub _flagtypes_nonchanged {
+ my ($self, $args) = @_;
+ my ($chart_id, $operator, $value, $joins, $bugs_table) =
+ @$args{qw(chart_id operator value joins bugs_table)};
+ my $dbh = Bugzilla->dbh;
+ my $join;
+
+ # join to the attachments table
+ my $attach_table = "attachments_$chart_id";
+ $join = {
+ table => 'attachments',
+ as => $attach_table,
+ from => "$bugs_table.bug_id",
+ to => "bug_id",
+ extra => [ ($self->_user->is_insider ? '' : "$attach_table.isprivate = 0") ],
+ };
+ push(@$joins, $join);
+
+ # join to the flags table
+ my $flags_table = "flags_$chart_id";
+ $join = {
+ table => 'flags',
+ as => $flags_table,
+ from => "$bugs_table.bug_id",
+ to => "bug_id",
+ extra => [ "($flags_table.attach_id = $attach_table.attach_id " .
+ " OR $flags_table.attach_id IS NULL)" ],
+ };
+ push(@$joins, $join);
+
+ # join to the flagtypes table
+ my $flagtypes_table = "flagtypes_$chart_id";
+ $join = {
+ table => 'flagtypes',
+ as => $flagtypes_table,
+ from => "$flags_table.type_id",
+ to => "id",
+ };
+ push(@$joins, $join);
+
+ # join to the profiles table for the requestee
+ my $flag_profile_table = "flag_profiles_$chart_id";
+ $join = {
+ table => 'profiles',
+ as => $flag_profile_table,
+ from => "$flags_table.requestee_id",
+ to => "userid",
+ };
+ push(@$joins, $join);
+
+ $args->{full_field} = $dbh->sql_string_concat("$flagtypes_table.name",
+ "$flags_table.status",
+ "COALESCE($flag_profile_table.login_name, '')");
+
+ $self->_do_operator_function($args);
+}
+
sub _multiselect_nonchanged {
my ($self, $args) = @_;
my ($chart_id, $joins, $field, $operator) =