]> 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:34:43 +0000 (16:34 -0700)
committerMax Kanat-Alexander <mkanat@bugzilla.org>
Mon, 5 Jul 2010 23:34:43 +0000 (16:34 -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 90d22c38c932327dadc36f22257909318cc7adb0..61f5e995ed93ba103e42b7ffc78af6a0a91fd9c8 100644 (file)
@@ -155,12 +155,17 @@ use constant OPERATOR_FIELD_OVERRIDE => {
     },
     keywords => {
         equals       => \&_keywords_exact,
-        notequals    => \&_keywords_exact,
         anyexact     => \&_keywords_exact,
-        anywords     => \&_keywords_exact,
+        anyword      => \&_keywords_exact,
         allwords     => \&_keywords_exact,
-        nowords      => \&_keywords_exact,
-        _non_changed => \&_keywords_nonchanged,
+
+        notequals     => \&_multiselect_negative,
+        notregexp     => \&_multiselect_negative,
+        notsubstring  => \&_multiselect_negative,
+        nowords       => \&_multiselect_negative,
+        nowordssubstr => \&_multiselect_negative,
+
+        _non_changed  => \&_keywords_nonchanged,
     },
     'flagtypes.name' => {
         _default => \&_flagtypes_name,
@@ -2052,7 +2057,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)) {
@@ -2202,8 +2207,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";
+    }
     
     $$t = $map{$$t};
     $self->_do_operator_function(\%func_args);