From: Fredric T Parks Date: Fri, 14 Feb 2014 01:03:29 +0000 (-0800) Subject: Fix issue where boolean operators were used on non-boolean searches X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=7ac4ad97b9c40e66df9229b5c6b7cb280a6f0d99;p=working%2FEvergreen.git Fix issue where boolean operators were used on non-boolean searches because query parser isn't reinstantiated after each search. I alse modified boolean.tt2 so it displays filters just like advanced search Signed-off-by: Fredrick T Parks modified: Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/Publisher/metabib.pm modified: Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/QueryParser.pm modified: Open-ILS/src/templates/opac/parts/advanced/boolean.tt2 --- diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/Publisher/metabib.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/Publisher/metabib.pm index 0e482cb148..bdbbf33183 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/Publisher/metabib.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/Publisher/metabib.pm @@ -3206,7 +3206,6 @@ sub query_parser_fts_wrapper { _initialize_parser($parser) unless $parser->initialization_complete; #If this is a boolean search set the human readable operators - #XXX hard coded to just use english for now. Needs to be able to take forign keywords if(exists $args{"_boolean"}) { $operators = retreave_boolean_keywords($args{"_boolean"}); @@ -3297,7 +3296,14 @@ sub query_parser_fts_wrapper { $log->debug("Full QueryParser query: $query", DEBUG); - return query_parser_fts($self, $client, query => $query, _simple_plan => $base_plan->simple_plan ); + my $results = query_parser_fts($self, $client, query => $query, _simple_plan => $base_plan->simple_plan ); + + #If this is a boolean keyword search reset to the default operators, so standard searches are not affected + if(exists $args{"_boolean"}) { + $parser->reset_operators(); + } + + return $results; } __PACKAGE__->register_method( api_name => "open-ils.storage.biblio.multiclass.staged.search_fts", 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 1b5458d2b9..16dda40eb5 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/QueryParser.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/QueryParser.pm @@ -117,6 +117,24 @@ sub operators { return $parser_config{$class}{operators}; } +=head2 reset_operators + +Resets the operators to %parser_config +=cut + +sub reset_operators { + my $class = shift; + + #foreach my $op (keys %parser_config{$class}{operators}) { + # $class->operator($op, $parser_config{$class}{operators}{$op}); + #} + for my $o (keys %{QueryParser->operators}) { + $class->operator($o => QueryParser->operator($o)); + } + + return $class->operators(); +} + sub allow_nested_modifiers { my $class = shift; my $v = shift; diff --git a/Open-ILS/src/templates/opac/parts/advanced/boolean.tt2 b/Open-ILS/src/templates/opac/parts/advanced/boolean.tt2 index 05c8b033bd..d24dc1dcd1 100644 --- a/Open-ILS/src/templates/opac/parts/advanced/boolean.tt2 +++ b/Open-ILS/src/templates/opac/parts/advanced/boolean.tt2 @@ -34,7 +34,8 @@ - + @@ -47,10 +48,10 @@ NEXT IF adv_chunk.adv_hide; IF in_row == 0; in_row = 1; %] -
+
[% END; %] -
+
[% CASE "pub_year"; %] -