From: Mike Rylander Date: Fri, 7 Sep 2012 18:15:21 +0000 (-0400) Subject: Automatic push-down of explicitly-bool-connected conditions X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=ab2ad3021bed381f83025051e69e32fbb9f44aba;p=working%2FEvergreen.git push-down of explicitly-bool-connected conditions Signed-off-by: Mike Rylander Signed-off-by: Thomas Berezansky --- diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/QueryParser.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/QueryParser.pm index 7ee0402dd4..0c9f85c8f7 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/QueryParser.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/QueryParser.pm @@ -646,7 +646,12 @@ sub decompose { next if ($last_type eq 'OR'); warn "Encountered AND\n" if $self->debug; - $struct->joiner( '&' ); + my $LHS = $struct; + my ($RHS, $subremainder) = $self->decompose( $_, $current_class, $recursing + 1 ); + $_ = $subremainder; + + $struct = $self->new_plan( level => $recursing, joiner => '&' ); + $struct->add_node($_) for ($LHS, $RHS); $last_type = 'AND'; } elsif (/$or_re/) { # ORed expression @@ -655,7 +660,12 @@ sub decompose { next if ($last_type eq 'OR'); warn "Encountered OR\n" if $self->debug; - $struct->joiner( '|' ); + my $LHS = $struct; + my ($RHS, $subremainder) = $self->decompose( $_, $current_class, $recursing + 1 ); + $_ = $subremainder; + + $struct = $self->new_plan( level => $recursing, joiner => '|' ); + $struct->add_node($_) for ($LHS, $RHS); $last_type = 'OR'; } elsif ($self->facet_class_count && /$facet_re/) { # changing current class