Merge branch 'bug_9961' into 3.14-master

This commit is contained in:
Jared Camins-Esakov 2013-05-08 09:44:29 -04:00
commit d406c9957d
3 changed files with 22 additions and 13 deletions

View File

@ -112,6 +112,7 @@ sub FindDuplicate {
$titleindex = 'title|exact';
$authorindex = 'author|exact';
$op = '&&';
$QParser->custom_data->{'QueryAutoTruncate'} = C4::Context->preference('QueryAutoTruncate');
} else {
$titleindex = 'ti,ext';
$authorindex = 'au,ext';
@ -233,6 +234,9 @@ sub SimpleSearch {
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++ ) {
@ -1177,6 +1181,7 @@ sub parseQuery {
if ($QParser)
{
$QParser->custom_data->{'QueryAutoTruncate'} = C4::Context->preference('QueryAutoTruncate');
$query = '';
for ( my $ii = 0 ; $ii <= @operands ; $ii++ ) {
next unless $operands[$ii];

View File

@ -349,23 +349,23 @@ not want to use it.
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;
}

View File

@ -57,6 +57,7 @@ sub target_syntax {
$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++;
@ -70,6 +71,9 @@ sub target_syntax {
$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++;