From 205ea5125eb0c22932ea5774d299d7cac2ba3301 Mon Sep 17 00:00:00 2001 From: Mike Rylander Date: Fri, 7 Sep 2012 14:15:21 -0400 Subject: [PATCH] Automatic push-down of explicitly-bool-connected conditions Signed-off-by: Mike Rylander Signed-off-by: Thomas Berezansky Signed-off-by: Lebbeous Fogle-Weekley --- .../lib/OpenILS/Application/Storage/QueryParser.pm | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) 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 -- 2.43.2