RSS

trunk : 6116

mkanat%bugzilla.org
2008-07-01 08:12:12
Revision ID: cvs-1:mkanatbugzilla.org-20080701131212-2f811n1583nnv9mn
Bug 432601: [Oracle] Fix 'Find a specific Bug' (fulltext searching) Patch By Xiaoou Wu <xiaoou.wu@oracle.com> r=mkanat, a=mkanat

collapse all collapse all

added added

removed removed

146
    return " TO_DATE($date,'J') ";
146
    return " TO_DATE($date,'J') ";
147
}
147
}
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)";
153
}
153
}
154
 
154
 
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");
1240
    
1240
    
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", 
 
 
1245
                                                        $$v, 2);
 
 
1246
    $rterm1 = $term1 if !$rterm1;
 
 
1247
    $rterm2 = $term2 if !$rterm2;
 
 
1248
 
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";
1247
    
1251
    
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";
1252
 
1256
 
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

Loggerhead runs on Bazaar branches