From 6f5e915c085a7f66d6784a6632566ecb3dcbe18e Mon Sep 17 00:00:00 2001 From: "mkanat%bugzilla.org" Date: Tue, 1 Mar 2011 13:50:26 +0000 Subject: [PATCH] Bug 634144: Make possible_duplicates work on PostgreSQL r=mkanat, a=mkanat git-svn-id: svn://10.0.0.236/trunk@261977 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/webtools/bugzilla/.bzrrev | 2 +- mozilla/webtools/bugzilla/Bugzilla/DB.pm | 14 +++++++++++--- mozilla/webtools/bugzilla/Bugzilla/Search.pm | 2 +- 3 files changed, 13 insertions(+), 5 deletions(-) diff --git a/mozilla/webtools/bugzilla/.bzrrev b/mozilla/webtools/bugzilla/.bzrrev index a96d0e223ec..b102aaa2017 100644 --- a/mozilla/webtools/bugzilla/.bzrrev +++ b/mozilla/webtools/bugzilla/.bzrrev @@ -1 +1 @@ -7725 \ No newline at end of file +7726 \ No newline at end of file diff --git a/mozilla/webtools/bugzilla/Bugzilla/DB.pm b/mozilla/webtools/bugzilla/Bugzilla/DB.pm index 095063f022b..8d1cf32a0b0 100644 --- a/mozilla/webtools/bugzilla/Bugzilla/DB.pm +++ b/mozilla/webtools/bugzilla/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 -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/mozilla/webtools/bugzilla/Bugzilla/Search.pm b/mozilla/webtools/bugzilla/Bugzilla/Search.pm index bf9dbcb2e49..34100b4baa1 100644 --- a/mozilla/webtools/bugzilla/Bugzilla/Search.pm +++ b/mozilla/webtools/bugzilla/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)"; }