]> git.ipfire.org Git - thirdparty/bugzilla.git/commitdiff
Bug 432601: [Oracle] Fix 'Find a Specific Bug' (fulltext search)
authormkanat%bugzilla.org <>
Tue, 1 Jul 2008 13:13:25 +0000 (13:13 +0000)
committermkanat%bugzilla.org <>
Tue, 1 Jul 2008 13:13:25 +0000 (13:13 +0000)
Patch By Xiaoou Wu <xiaoou.wu@oracle.com> r=mkanat, a=mkanat

Bugzilla/DB/Oracle.pm
Bugzilla/Search.pm

index 9e8ea73020140dfe035588f758c5308d8d96a29f..92f1247de7881985c02eacfc6cc6c12660eb1d4b 100644 (file)
@@ -132,10 +132,10 @@ sub sql_from_days{
     return " TO_DATE($date,'J') ";
 }
 sub sql_fulltext_search {
-    my ($self, $column, $text) = @_;
+    my ($self, $column, $text, $label) = @_;
     $text = $self->quote($text);
     trick_taint($text);
-    return "CONTAINS($column,$text)";
+    return "CONTAINS($column,$text,$label)", "SCORE($label)";
 }
 
 sub sql_date_format {
index 272b41152972623a2650a2c311a0483d67a8c75b..2f8d86c8e66241870fa7684da87f50c55e7f9994 100644 (file)
@@ -1239,16 +1239,20 @@ sub _content_matches {
                        "ON bugs.bug_id = $table.bug_id");
     
     # Create search terms to add to the SELECT and WHERE clauses.
-    my $term1 = $dbh->sql_fulltext_search("$table.$comments_col", $$v);
-    my $term2 = $dbh->sql_fulltext_search("$table.short_desc", $$v);
-    
+    my ($term1, $rterm1) = $dbh->sql_fulltext_search("$table.$comments_col", 
+                                                        $$v, 1);
+    my ($term2, $rterm2) = $dbh->sql_fulltext_search("$table.short_desc", 
+                                                        $$v, 2);
+    $rterm1 = $term1 if !$rterm1;
+    $rterm2 = $term2 if !$rterm2;
+
     # The term to use in the WHERE clause.
     $$term = "$term1 > 0 OR $term2 > 0";
     
     # In order to sort by relevance (in case the user requests it),
     # we SELECT the relevance value and give it an alias so we can
     # add it to the SORT BY clause when we build it in buglist.cgi.
-    my $select_term = "($term1 + $term2) AS relevance";
+    my $select_term = "($rterm1 + $rterm2) AS relevance";
 
     # Users can specify to display the relevance field, in which case
     # it'll show up in the list of fields being selected, and we need