remove errant tsearch joiners if the normalizers are messy and leave leading/trailing...
authormiker <miker@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Fri, 21 May 2010 15:52:42 +0000 (15:52 +0000)
committermiker <miker@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Fri, 21 May 2010 15:52:42 +0000 (15:52 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@16474 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/src/perlmods/OpenILS/Application/Storage/Driver/Pg/QueryParser.pm

index 062ae64..c05d7af 100644 (file)
@@ -778,7 +778,7 @@ sub buildSQL {
     my $suffix_op = ":$suffix" if $suffix;
     my $suffix_after = "|| '$suffix_op'" if $suffix;
 
-    $sql = "to_tsquery('$classname', $prefix '(' || regexp_replace($sql,E'(?:\\\\s+|:)','$suffix_op&','g') $suffix_after || ')')";
+    $sql = "to_tsquery('$classname', $prefix '(' || btrim(regexp_replace($sql,E'(?:\\\\s+|:)','$suffix_op&','g'),'&|') $suffix_after || ')')";
 
     return $self->sql($sql);
 }