[open-ils-commits] [GIT] Evergreen ILS branch rel_2_1 updated. 2b2b8b6265574a1e220ecb80bfb6ec334c11e715

Evergreen Git git at git.evergreen-ils.org
Thu Aug 25 16:54:31 EDT 2011


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Evergreen ILS".

The branch, rel_2_1 has been updated
       via  2b2b8b6265574a1e220ecb80bfb6ec334c11e715 (commit)
      from  2a87925cb2ff9e11f554ada567d0c1289b5c7dda (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 2b2b8b6265574a1e220ecb80bfb6ec334c11e715
Author: Mike Rylander <mrylander at gmail.com>
Date:   Thu Aug 25 15:56:15 2011 -0400

    Push phrases down to be subqueries, so they can be ORed together
    
    Signed-off-by: Mike Rylander <mrylander at gmail.com>
    Signed-off-by: Lebbeous Fogle-Weekley <lebbeous at esilibrary.com>

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 3ccd566..dc4cfef 100644
--- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/QueryParser.pm
+++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/QueryParser.pm
@@ -468,6 +468,7 @@ sub decompose {
     my $current_class = shift || $self->default_search_class;
 
     my $recursing = shift || 0;
+    my $phrase_helper = shift || 0;
 
     # Build the search class+field uber-regexp
     my $search_class_re = '^\s*(';
@@ -649,23 +650,35 @@ sub decompose {
         } elsif (/^\s*($required_re|$disallowed_re)?"([^"]+)"/) { # phrase, always anded
             warn 'Encountered' . ($1 ? " ['$1' modified]" : '') . " phrase: $2\n" if $self->debug;
 
-            $struct->joiner( '&' );
-            my $req_ness = $1;
+            my $req_ness = $1 || '';
             my $phrase = $2;
 
-            my $class_node = $struct->classed_node($current_class);
+            if (!$phrase_helper) {
+                warn "Recursing into decompose with the phrase as a subquery\n" if $self->debug;
+                my $after = $';
+                my ($substruct, $subremainder) = $self->decompose( qq/$req_ness"$phrase"/, $current_class, $recursing + 1, 1 );
+                $struct->add_node( $substruct ) if ($substruct);
+                $_ = $after;
+            } else {
+                warn "Directly parsing the phrase subquery\n" if $self->debug;
+                $struct->joiner( '&' );
+
+                my $class_node = $struct->classed_node($current_class);
+
+                if ($req_ness eq $pkg->operator('disallowed')) {
+                    $class_node->add_dummy_atom( node => $class_node );
+                    $class_node->add_unphrase( $phrase );
+                    $phrase = '';
+                    #$phrase =~ s/(^|\s)\b/$1-/g;
+                } else { 
+                    $class_node->add_phrase( $phrase );
+                }
+                $_ = $phrase . $';
 
-            if ($req_ness eq $pkg->operator('disallowed')) {
-                $class_node->add_dummy_atom( node => $class_node );
-                $class_node->add_unphrase( $phrase );
-                $phrase = '';
-                #$phrase =~ s/(^|\s)\b/$1-/g;
-            } else { 
-                $class_node->add_phrase( $phrase );
             }
-            $_ = $phrase . $';
 
             $last_type = '';
+
 #        } elsif (/^\s*$required_re([^\s"]+)/) { # phrase, always anded
 #            warn "Encountered required atom (mini phrase): $1\n" if $self->debug;
 #

-----------------------------------------------------------------------

Summary of changes:
 .../lib/OpenILS/Application/Storage/QueryParser.pm |   35 +++++++++++++------
 1 files changed, 24 insertions(+), 11 deletions(-)


hooks/post-receive
-- 
Evergreen ILS


More information about the open-ils-commits mailing list