146
return " TO_DATE($date,'J') ";
146
return " TO_DATE($date,'J') ";
148
sub sql_fulltext_search {
148
sub sql_fulltext_search {
149
my ($self, $column, $text) = @_;
149
my ($self, $column, $text, $label) = @_;
150
$text = $self->quote($text);
150
$text = $self->quote($text);
151
trick_taint($text);
151
trick_taint($text);
152
return "CONTAINS($column,$text)";
152
return "CONTAINS($column,$text,$label)", "SCORE($label)";
155
sub sql_date_format {
155
sub sql_date_format {
1239
"ON bugs.bug_id = $table.bug_id");
1239
"ON bugs.bug_id = $table.bug_id");
1241
# Create search terms to add to the SELECT and WHERE clauses.
1241
# Create search terms to add to the SELECT and WHERE clauses.
1242
my $term1 = $dbh->sql_fulltext_search("$table.$comments_col", $$v);
1242
my ($term1, $rterm1) = $dbh->sql_fulltext_search("$table.$comments_col",
1243
my $term2 = $dbh->sql_fulltext_search("$table.short_desc", $$v);
1243
$$v, 1);
1244
1244
my ($term2, $rterm2) = $dbh->sql_fulltext_search("$table.short_desc",
1246
$rterm1 = $term1 if !$rterm1;
1247
$rterm2 = $term2 if !$rterm2;
1245
# The term to use in the WHERE clause.
1249
# The term to use in the WHERE clause.
1246
$$term = "$term1 > 0 OR $term2 > 0";
1250
$$term = "$term1 > 0 OR $term2 > 0";
1248
# In order to sort by relevance (in case the user requests it),
1252
# In order to sort by relevance (in case the user requests it),
1249
# we SELECT the relevance value and give it an alias so we can
1253
# we SELECT the relevance value and give it an alias so we can
1250
# add it to the SORT BY clause when we build it in buglist.cgi.
1254
# add it to the SORT BY clause when we build it in buglist.cgi.
1251
my $select_term = "($term1 + $term2) AS relevance";
1255
my $select_term = "($rterm1 + $rterm2) AS relevance";
1253
# Users can specify to display the relevance field, in which case
1257
# Users can specify to display the relevance field, in which case
1254
# it'll show up in the list of fields being selected, and we need
1258
# it'll show up in the list of fields being selected, and we need