summaryrefslogtreecommitdiffstats
path: root/buglist.cgi
diff options
context:
space:
mode:
authorjustdave%syndicomm.com <>2001-06-02 13:02:13 +0200
committerjustdave%syndicomm.com <>2001-06-02 13:02:13 +0200
commitb0aff47d71d587a512673fe78c910024fc675f9d (patch)
treeacd168f006aec0c994e14ffa495171b7cdc94b9b /buglist.cgi
parenta05fe5024513bf2772682437311bd80b6675fb2d (diff)
downloadbugzilla-b0aff47d71d587a512673fe78c910024fc675f9d.tar.gz
bugzilla-b0aff47d71d587a512673fe78c910024fc675f9d.tar.xz
Fix for bug 65190: add comparison type "all words as substrings" and "any words as substrings" to the text fields in query.cgi
Patch by Andreas Franke <afranke@ags.uni-sb.de> r= justdave@syndicomm.com
Diffstat (limited to 'buglist.cgi')
-rwxr-xr-xbuglist.cgi28
1 files changed, 28 insertions, 0 deletions
diff --git a/buglist.cgi b/buglist.cgi
index 8bc12b72e..b99afefe9 100755
--- a/buglist.cgi
+++ b/buglist.cgi
@@ -21,6 +21,7 @@
# Contributor(s): Terry Weissman <terry@mozilla.org>
# Dan Mosedale <dmose@mozilla.org>
# Stephan Niemz <st.n@gmx.net>
+# Andreas Franke <afranke@mathweb.org>
use diagnostics;
use strict;
@@ -107,6 +108,21 @@ sub GetByWordList {
return \@list;
}
+#
+# support for "any/all/nowordssubstr" comparison type ("words as substrings")
+#
+sub GetByWordListSubstr {
+ my ($field, $strs) = (@_);
+ my @list;
+
+ foreach my $word (split(/[\s,]+/, $strs)) {
+ if ($word ne "") {
+ push(@list, "INSTR(LOWER($field), " . lc(SqlQuote($word)) . ")");
+ }
+ }
+
+ return \@list;
+}
sub Error {
@@ -491,6 +507,18 @@ sub GenerateSQL {
}
$term = join(" OR ", @list);
},
+ ",anywordssubstr" => sub {
+ $term = join(" OR ", @{GetByWordListSubstr($ff, $v)});
+ },
+ ",allwordssubstr" => sub {
+ $term = join(" AND ", @{GetByWordListSubstr($ff, $v)});
+ },
+ ",nowordssubstr" => sub {
+ my @list = @{GetByWordListSubstr($ff, $v)};
+ if (@list) {
+ $term = "NOT (" . join(" OR ", @list) . ")";
+ }
+ },
",anywords" => sub {
$term = join(" OR ", @{GetByWordList($ff, $v)});
},