Bug 24367: Resolve warn Negative repeat count does nothing
authorMarcel de Rooy <m.de.rooy@rijksmuseum.nl>
Fri, 10 Jan 2020 08:07:05 +0000 (08:07 +0000)
committerMartin Renvoize <martin.renvoize@ptfs-europe.com>
Wed, 19 Feb 2020 11:22:19 +0000 (11:22 +0000)
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.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

Koha/QueryParser/Driver/PQF/query_plan.pm
Koha/QueryParser/Driver/PQF/query_plan/node.pm

index 19544b8..320410e 100644 (file)
@@ -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;
index 353d760..9b77ba7 100644 (file)
@@ -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;
 }