Bug 562014: Fix negative keyword searches like "contains none of the words"

to properly find bugs with *none* of the listed keywords, and also to find
bugs with no keywords at all.
r=LpSolit, a=LpSolit


git-svn-id: svn://10.0.0.236/branches/BUGZILLA-3_6-BRANCH@260633 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
mkanat%bugzilla.org
2010-07-05 23:50:55 +00:00
parent 756ce1c470
commit 6e53c47508
2 changed files with 14 additions and 5 deletions

View File

@@ -1 +1 @@
7119
7120

View File

@@ -647,7 +647,8 @@ sub init {
"^component,(?!changed)" => \&_component_nonchanged,
"^product,(?!changed)" => \&_product_nonchanged,
"^classification,(?!changed)" => \&_classification_nonchanged,
"^keywords,(?:equals|notequals|anyexact|anyword|allwords|nowords)" => \&_keywords_exact,
"^keywords,(?:equals|anyexact|anyword|allwords)" => \&_keywords_exact,
"^keywords,(?:notequals|notregexp|notsubstring|nowords|nowordssubstr)" => \&_multiselect_negative,
"^keywords,(?!changed)" => \&_keywords_nonchanged,
"^dependson,(?!changed)" => \&_dependson_nonchanged,
"^blocked,(?!changed)" => \&_blocked_nonchanged,
@@ -1891,7 +1892,7 @@ sub _keywords_exact {
my %func_args = @_;
my ($chartid, $v, $ff, $f, $t, $term, $supptables) =
@func_args{qw(chartid v ff f t term supptables)};
my @list;
my $table = "keywords_$$chartid";
foreach my $value (split(/[\s,]+/, $$v)) {
@@ -2039,8 +2040,16 @@ sub _multiselect_negative {
nowordssubstr => 'anywordssubstr',
);
my $table = "bug_$$f";
$$ff = "$table.value";
my $table;
if ($$f eq 'keywords') {
$table = "keywords LEFT JOIN keyworddefs"
. " ON keywords.keywordid = keyworddefs.id";
$$ff = "keyworddefs.name";
}
else {
$table = "bug_$$f";
$$ff = "$table.value";
}
$$funcsbykey{",".$map{$$t}}($self, %func_args);
$$term = "bugs.bug_id NOT IN (SELECT bug_id FROM $table WHERE $$term)";