From 808bd714203fbd167d889c880b9d07cd12e82e42 Mon Sep 17 00:00:00 2001 From: gmc Date: Thu, 15 Jul 2010 15:15:43 +0000 Subject: [PATCH] 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 git-svn-id: svn://svn.open-ils.org/ILS/trunk@16939 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- .../src/perlmods/OpenILS/Application/Storage/Driver/Pg/QueryParser.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Open-ILS/src/perlmods/OpenILS/Application/Storage/Driver/Pg/QueryParser.pm b/Open-ILS/src/perlmods/OpenILS/Application/Storage/Driver/Pg/QueryParser.pm index 02e54f4ee..cbff57056 100644 --- a/Open-ILS/src/perlmods/OpenILS/Application/Storage/Driver/Pg/QueryParser.pm +++ b/Open-ILS/src/perlmods/OpenILS/Application/Storage/Driver/Pg/QueryParser.pm @@ -778,7 +778,7 @@ sub buildSQL { 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); } -- 2.11.0