$titleindex = 'title|exact';
$authorindex = 'author|exact';
$op = '&&';
+ $QParser->custom_data->{'QueryAutoTruncate'} = C4::Context->preference('QueryAutoTruncate');
} else {
$titleindex = 'ti,ext';
$authorindex = 'au,ext';
my $QParser;
$QParser = C4::Context->queryparser if (C4::Context->preference('UseQueryParser') && ! ($query =~ m/\w,\w|\w=\w/));
+ if ($QParser) {
+ $QParser->custom_data->{'QueryAutoTruncate'} = C4::Context->preference('QueryAutoTruncate');
+ }
# Initialize & Search Zebra
for ( my $i = 0 ; $i < @servers ; $i++ ) {
if ($QParser)
{
+ $QParser->custom_data->{'QueryAutoTruncate'} = C4::Context->preference('QueryAutoTruncate');
$query = '';
for ( my $ii = 0 ; $ii <= @operands ; $ii++ ) {
next unless $operands[$ii];
sub clear_all_configuration {
my ($self) = @_;
%OpenILS::QueryParser::parser_config = (
- 'OpenILS::QueryParser' => {
+ 'OpenILS::QueryParser' => {
filters => [],
modifiers => [],
operators => {
- 'and' => '&&',
- 'or' => '||',
- float_start => '{{',
- float_end => '}}',
- group_start => '(',
- group_end => ')',
- required => '+',
- disallowed => '-',
- modifier => '#',
- negated => '!'
+ 'and' => '&&',
+ 'or' => '||',
+ float_start => '{{',
+ float_end => '}}',
+ group_start => '(',
+ group_end => ')',
+ required => '+',
+ disallowed => '-',
+ modifier => '#',
+ negated => '!'
}
- }
- );
+ }
+ );
return $self;
}
$phrase =~ s/"/\\"/g;
$pqf .= ' @or ' x (scalar(@fields) - 1);
foreach my $attributes (@fields) {
+ $attributes->{'attr_string'} ||= '';
$pqf .= $attributes->{'attr_string'} . ($attributes->{'4'} ? '' : ' @attr 4=1') . ' "' . $phrase . '" ';
}
$atom_count++;
$pqf .= ' @or ' x (scalar(@fields) - 1);
foreach my $attributes (@fields) {
$attributes->{'attr_string'} ||= '';
+ if ($self->plan->QueryParser->custom_data->{'QueryAutoTruncate'} || $atom->suffix eq '*') {
+ $attributes->{'attr_string'} .= ($attributes->{'5'} ? '' : ' @attr 5=1 ');
+ }
$pqf .= $attributes->{'attr_string'} . ($attributes->{'4'} ? '' : ' @attr 4=6 ') . $atom_content . ' ';
}
$atom_count++;