fixing case of only negated words
[Evergreen.git] / 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);