fixing case of only negated words
authormiker <miker@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Thu, 15 Dec 2005 18:47:33 +0000 (18:47 +0000)
committermiker <miker@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Thu, 15 Dec 2005 18:47:33 +0000 (18:47 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@2409 dcc99617-32d9-48b4-a31d-7c20da2025e4

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

index c508346..867ab52 100644 (file)
                $term =~ s/(\pM+)//gos;
                $self->decompose($term);
 
-               my $newterm = join('&', $self->words);
+               my $newterm = '';
+               $newterm = join('&', $self->words) if ($self->words);
 
                if (@{$self->nots}) {
-                       $newterm = '('.$newterm.')&!('. join('|', $self->nots) . ')';
+                       $newterm = '('.$newterm.')&' if ($newterm);
+                       $newterm .= '!('. join('|', $self->nots) . ')';
                }
 
                $log->debug("Compiled term is [$newterm]", DEBUG);