summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSam Morris <sam@robots.org.uk>2011-03-01 14:41:58 +0100
committerMax Kanat-Alexander <mkanat@bugzilla.org>2011-03-01 14:41:58 +0100
commitb048930efb8b64acd3c5785fc6dd69f1cdc766ff (patch)
tree787b02f07d2f90322e2a74d77b3516a3b721dbd1
parent5137b07bae62f27dbacee3fbd82a529df1ee8b46 (diff)
downloadbugzilla-b048930efb8b64acd3c5785fc6dd69f1cdc766ff.tar.gz
bugzilla-b048930efb8b64acd3c5785fc6dd69f1cdc766ff.tar.xz
Bug 634144: Make possible_duplicates work on PostgreSQL
r=mkanat, a=mkanat
-rw-r--r--Bugzilla/DB.pm14
-rw-r--r--Bugzilla/Search.pm2
2 files changed, 12 insertions, 4 deletions
diff --git a/Bugzilla/DB.pm b/Bugzilla/DB.pm
index 095063f02..8d1cf32a0 100644
--- a/Bugzilla/DB.pm
+++ b/Bugzilla/DB.pm
@@ -437,7 +437,7 @@ sub sql_fulltext_search {
@words = map("LOWER($column) LIKE $_", @words);
# search for occurrences of all specified words in the column
- return "CASE WHEN (" . join(" AND ", @words) . ") THEN 1 ELSE 0 END";
+ return join (" AND ", @words), "CASE WHEN (" . join(" AND ", @words) . ") THEN 1 ELSE 0 END";
}
#####################################################################
@@ -2077,8 +2077,16 @@ Note that both parameters need to be sql-quoted.
=item B<Description>
-Returns SQL syntax for performing a full text search for specified text
-on a given column.
+Returns one or two SQL expressions for performing a full text search for
+specified text on a given column.
+
+If one value is returned, it is a numeric expression that indicates
+a match with a positive value and a non-match with zero. In this case,
+the DB must support casting numeric expresions to booleans.
+
+If two values are returned, then the first value is a boolean expression
+that indicates the presence of a match, and the second value is a numeric
+expression that can be used for ranking.
There is a ANSI SQL version of this method implemented using LIKE operator,
but it's not a real full text search. DB specific modules should override
diff --git a/Bugzilla/Search.pm b/Bugzilla/Search.pm
index bf9dbcb2e..34100b4ba 100644
--- a/Bugzilla/Search.pm
+++ b/Bugzilla/Search.pm
@@ -2263,7 +2263,7 @@ sub _content_matches {
$rterm2 = $term2 if !$rterm2;
# The term to use in the WHERE clause.
- my $term = "$term1 > 0 OR $term2 > 0";
+ my $term = "$term1 OR $term2";
if ($operator =~ /not/i) {
$term = "NOT($term)";
}