Automatic push-down of explicitly-bool-connected conditions
authorMike Rylander <mrylander@gmail.com>
Fri, 7 Sep 2012 18:15:21 +0000 (14:15 -0400)
committerLebbeous Fogle-Weekley <lebbeous@esilibrary.com>
Fri, 15 Feb 2013 20:39:44 +0000 (15:39 -0500)
Signed-off-by: Mike Rylander <mrylander@gmail.com>
Signed-off-by: Thomas Berezansky <tsbere@mvlc.org>
Signed-off-by: Lebbeous Fogle-Weekley <lebbeous@esilibrary.com>
Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/QueryParser.pm

index 7ee0402..0c9f85c 100644 (file)
@@ -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