]> git.ipfire.org Git - thirdparty/bugzilla.git/commitdiff
Bug 562014: Fix negative keyword searches like "contains none of the words"
authorMax Kanat-Alexander <mkanat@bugzilla.org>
Mon, 5 Jul 2010 23:39:24 +0000 (16:39 -0700)
committerMax Kanat-Alexander <mkanat@bugzilla.org>
Mon, 5 Jul 2010 23:39:24 +0000 (16:39 -0700)
to properly find bugs with *none* of the listed keywords, and also to find
bugs with no keywords at all.
r=LpSolit, a=LpSolit

Bugzilla/Search.pm

index 9f13d0117b96410e5b507f76a77e8d5eda25da40..d946d928d3fe8d49afa89f7a64ac86f7f5337137 100644 (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)";