[open-ils-commits] r16939 - trunk/Open-ILS/src/perlmods/OpenILS/Application/Storage/Driver/Pg (gmc)

svn at svn.open-ils.org svn at svn.open-ils.org
Thu Jul 15 11:15:46 EDT 2010


Author: gmc
Date: 2010-07-15 11:15:43 -0400 (Thu, 15 Jul 2010)
New Revision: 16939

Modified:
   trunk/Open-ILS/src/perlmods/OpenILS/Application/Storage/Driver/Pg/QueryParser.pm
Log:
bug 605921: fix bib search hang on queries like "title ; subtitle"

More generally, the fix avoids a to_tsquery exception in cases
where a search term is normalized away to the empty string.

Signed-off-by: Galen Charlton <gmc at esilibrary.com>


Modified: trunk/Open-ILS/src/perlmods/OpenILS/Application/Storage/Driver/Pg/QueryParser.pm
===================================================================
--- trunk/Open-ILS/src/perlmods/OpenILS/Application/Storage/Driver/Pg/QueryParser.pm	2010-07-15 13:52:06 UTC (rev 16938)
+++ trunk/Open-ILS/src/perlmods/OpenILS/Application/Storage/Driver/Pg/QueryParser.pm	2010-07-15 15:15:43 UTC (rev 16939)
@@ -778,7 +778,7 @@
     my $suffix_op = ":$suffix" if $suffix;
     my $suffix_after = "|| '$suffix_op'" if $suffix;
 
-    $sql = "to_tsquery('$classname', $prefix '(' || btrim(regexp_replace($sql,E'(?:\\\\s+|:)','$suffix_op&','g'),'&|') $suffix_after || ')')";
+    $sql = "to_tsquery('$classname', COALESCE(NULLIF($prefix '(' || btrim(regexp_replace($sql,E'(?:\\\\s+|:)','$suffix_op&','g'),'&|') $suffix_after || ')', '()'), ''))";
 
     return $self->sql($sql);
 }



More information about the open-ils-commits mailing list