$sql = $n->{function}."($sql)";
}
- $sql = "to_tsquery('$classname'," . ($self->prefix ? "\$_$$\$" . $self->prefix . "\$_$$\$||" : '') . "'('||regexp_replace($sql,E'(?:\\\\s+|:)','&','g')||')')";
+ my $prefix = $self->prefix || '';
+ my $suffix = $self->suffix || '';
+
+ $prefix = "'$prefix' ||" if $prefix;
+ 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 || ')')";
return $self->sql($sql);
}
my $class_node = $struct->classed_node($current_class);
my $negator = ($atom =~ s/^-//o) ? '!' : '';
+ my $truncate = ($atom =~ s/\*$//o) ? '*' : '';
- $class_node->add_fts_atom( $atom, prefix => $negator, node => $class_node );
+ $class_node->add_fts_atom( $atom, suffix => $truncate, prefix => $negator, node => $class_node );
$struct->joiner( '&' );
$_ = $after;
return $self->{prefix};
}
+sub suffix {
+ my $self = shift;
+ return undef unless (ref $self);
+ return $self->{suffix};
+}
+
#-------------------------------
package QueryParser::query_plan::filter;