From 45b1484b19b3c21840c9d043e02aed1b909108a0 Mon Sep 17 00:00:00 2001 From: Marcel de Rooy Date: Fri, 10 Jan 2020 08:07:05 +0000 Subject: [PATCH] Bug 24367: Resolve warn Negative repeat count does nothing Content-Type: text/plain; charset=utf-8 Negative repeat count does nothing at /usr/share/koha/Koha/QueryParser/Driver/PQF/query_plan.pm line 53. Negative repeat count does nothing at /usr/share/koha/Koha/QueryParser/Driver/PQF/query_plan/node.pm line 102. I am not sure if this statement actually does what the author intended, but adding the test on node_count/atom_count removes the warn. Repeating this change on query_plan.pm line 62. --- Koha/QueryParser/Driver/PQF/query_plan.pm | 4 ++-- Koha/QueryParser/Driver/PQF/query_plan/node.pm | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Koha/QueryParser/Driver/PQF/query_plan.pm b/Koha/QueryParser/Driver/PQF/query_plan.pm index 19544b8eaf..320410ed2e 100644 --- a/Koha/QueryParser/Driver/PQF/query_plan.pm +++ b/Koha/QueryParser/Driver/PQF/query_plan.pm @@ -50,7 +50,7 @@ sub target_syntax { $pqf .= $node_pqf; } } - $pqf = ($self->joiner eq '|' ? ' @or ' : ' @and ') x ($node_count - 1) . $pqf; + $pqf = ($self->joiner eq '|' ? ' @or ' : ' @and ') x ($node_count - 1) . $pqf if $node_count > 1; $node_count = ($node_count ? '1' : '0'); for my $node ( @{$self->filters} ) { if (ref($node)) { @@ -59,7 +59,7 @@ sub target_syntax { $pqf .= $node_pqf; } } - $pqf = ($self->joiner eq '|' ? ' @or ' : ' @and ') x ($node_count - 1) . $pqf; + $pqf = ($self->joiner eq '|' ? ' @or ' : ' @and ') x ($node_count - 1) . $pqf if $node_count > 1; foreach my $modifier ( @{$self->modifiers} ) { my $modifierpqf = $modifier->target_syntax($server, $self); $pqf = $modifierpqf . ' ' . $pqf if $modifierpqf; diff --git a/Koha/QueryParser/Driver/PQF/query_plan/node.pm b/Koha/QueryParser/Driver/PQF/query_plan/node.pm index 353d7602d1..9b77ba7ed0 100644 --- a/Koha/QueryParser/Driver/PQF/query_plan/node.pm +++ b/Koha/QueryParser/Driver/PQF/query_plan/node.pm @@ -99,7 +99,7 @@ sub target_syntax { } } } - $pqf = (OpenILS::QueryParser::_util::default_joiner eq '|' ? ' @or ' : ' @and ') x ($atom_count - 1) . $pqf; + $pqf = (OpenILS::QueryParser::_util::default_joiner eq '|' ? ' @or ' : ' @and ') x ($atom_count - 1) . $pqf if $atom_count > 1; return ($self->negate ? '@not @attr 1=_ALLRECORDS @attr 2=103 "" ' : '') . $pqf; } -- 2.11.0