Move allow_nested_modifiers to the driver level, provide a wrapper for it, and add...
authorMike Rylander <mrylander@gmail.com>
Mon, 10 Sep 2012 19:31:05 +0000 (15:31 -0400)
committerLebbeous Fogle-Weekley <lebbeous@esilibrary.com>
Fri, 15 Feb 2013 20:39:45 +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/Driver/Pg/QueryParser.pm
Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/QueryParser.pm

index cbfd99c..d566a37 100644 (file)
@@ -380,6 +380,8 @@ sub initialize {
 
 sub TEST_SETUP {
     
+    __PACKAGE__->allow_nested_modifiers(1);
+
     __PACKAGE__->add_search_field_id_map( series => seriestitle => 1 => 1 );
 
     __PACKAGE__->add_search_field_id_map( series => seriestitle => 1 => 1 );
index 6f948ef..0be69cb 100644 (file)
@@ -65,6 +65,15 @@ sub operators {
     return $parser_config{$class}{operators};
 }
 
+sub allow_nested_modifiers {
+    my $class = shift;
+    my $v = shift;
+    $class = ref($class) || $class;
+
+    $parser_config{$class}{allow_nested_modifiers} = $v if (defined $v);
+    return $parser_config{$class}{allow_nested_modifiers};
+}
+
 sub filters {
     my $class = shift;
     $class = ref($class) || $class;
@@ -650,7 +659,7 @@ sub decompose {
             warn "Encountered search modifier: $1\n" if $self->debug;
 
             $_ = $';
-            if (!($struct->top_plan || $parser_config{QueryParser}->{allow_nested_modifiers})) {
+            if (!($struct->top_plan || $parser_config{$pkg}->{allow_nested_modifiers})) {
                 warn "  Search modifiers only allowed at the top level of the query\n" if $self->debug;
             } else {
                 $struct->new_modifier($1);
@@ -663,7 +672,7 @@ sub decompose {
             my $mod = $1;
 
             $_ = $';
-            if (!($struct->top_plan || $parser_config{QueryParser}->{allow_nested_modifiers})) {
+            if (!($struct->top_plan || $parser_config{$pkg}->{allow_nested_modifiers})) {
                 warn "  Search modifiers only allowed at the top level of the query\n" if $self->debug;
             } elsif ($2 =~ /^[ty1]/i) {
                 $struct->new_modifier($mod);