+ my @or;
+ foreach my $f ( split(/,/,$1) ) {
+ push @or, "$f @@ to_tsquery(?)";
+ push @exec, $tsquery;
+ };
+ push @and, "( " . join(" or ", @or) . ")";
+ } else {
+ warn "INVALID QUERY [$query]";
+ }
+ }
+ $sql .= "where " . join(" and ", @and);
+
+warn "XXX SQL = ",$sql, dump( @exec );
+
+ my $dbh = DBI->connect_cached("dbi:Pg:dbname=$dbname", '', '', {AutoCommit => 0});
+
+ my $sth = $dbh->prepare( $sql );
+
+ $sth->execute( @exec );