Commit c6c81144 authored by terry%mozilla.org's avatar terry%mozilla.org

Allow searches for "all keywords" or "no keywords"; fixed some other

bugs around keyword queries.
parent afdd0f2f
...@@ -395,8 +395,24 @@ if ($::FORM{'keywords'}) { ...@@ -395,8 +395,24 @@ if ($::FORM{'keywords'}) {
} }
if (@list) { if (@list) {
$query =~ s/where/, keywords where/; $query =~ s/where/, keywords where/;
$query .= "and keywords.bug_id = bugs.bug_id and (" . my $type = $::FORM{'keywords_type'};
join(" $::FORM{'keywords_type'} ", @list) . ")\n"; my $notopt = "";
if ($type eq "nowords") {
# Ought to take advantage of keyword table somehow! ###
my $extra = GetByWordList("bugs.keywords", $::FORM{'keywords'},
"or");
$extra =~ s/AND/AND NOT/i;
$query .= $extra;
} else {
$query .= "and keywords.bug_id = bugs.bug_id and $notopt (" .
join(" or ", @list) . ")\n";
if ($type eq "allwords") {
# This needs to be tuned to take better advantage of the
# keyword table!
$query .= GetByWordList("bugs.keywords", $::FORM{'keywords'},
"and");
}
}
} }
} }
......
...@@ -136,8 +136,8 @@ sub ProcessFormStuff { ...@@ -136,8 +136,8 @@ sub ProcessFormStuff {
"changedin", "votes", "short_desc", "short_desc_type", "changedin", "votes", "short_desc", "short_desc_type",
"long_desc", "long_desc_type", "bug_file_loc", "long_desc", "long_desc_type", "bug_file_loc",
"bug_file_loc_type", "status_whiteboard", "bug_file_loc_type", "status_whiteboard",
"status_whiteboard_type", "keywords", "bug_id", "status_whiteboard_type", "bug_id",
"bugidtype") { "bugidtype", "keywords", "keywords_type") {
$default{$name} = ""; $default{$name} = "";
$type{$name} = 0; $type{$name} = 0;
} }
...@@ -643,18 +643,19 @@ if (@::legal_keywords) { ...@@ -643,18 +643,19 @@ if (@::legal_keywords) {
print qq{ print qq{
<TR> <TR>
<TD ALIGN="right"><A HREF="describekeywords.cgi">Keywords</A>:</TD> <TD ALIGN="right"><A HREF="describekeywords.cgi">Keywords</A>:</TD>
<TD><INPUT NAME="keywords" SIZE=30 VALUE=$def></TD> <TD><INPUT NAME="keywords" SIZE=30 VALUE="$def"></TD>
<TD><SELECT NAME=keywords_type> <TD>
}; };
foreach my $i (["or", "Any of the listed keywords set"]) { my $type = $default{"keywords_type"};
my ($n, $d) = (@$i); if ($type eq "or") { # Backward compatability hack.
my $sel = ""; $type = "anywords";
if ($default{"keywords"} eq $n) {
$sel = " SELECTED";
}
print qq{<OPTION VALUE="$n"$sel>$d\n};
} }
print qq{</SELECT></TD></TR>}; print BuildPulldown("keywords_type",
[["anywords", "Any of the listed keywords set"],
["allwords", "All of the listed keywords set"],
["nowords", "None of the listed keywords set"]],
$type);
print qq{</TD></TR>};
} }
print " print "
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment