[open-ils-commits] r16400 - in trunk: . Open-ILS/src/perlmods/OpenILS/Application/Storage Open-ILS/src/perlmods/OpenILS/Application/Storage/Driver/Pg (miker)

svn at svn.open-ils.org svn at svn.open-ils.org
Thu May 6 15:49:30 EDT 2010


Author: miker
Date: 2010-05-06 15:49:25 -0400 (Thu, 06 May 2010)
New Revision: 16400

Modified:
   trunk/
   trunk/Open-ILS/src/perlmods/OpenILS/Application/Storage/Driver/Pg/QueryParser.pm
   trunk/Open-ILS/src/perlmods/OpenILS/Application/Storage/QueryParser.pm
Log:
add explicit nesting parens in SQL; protect against empty class specifiers (throw them away)


Property changes on: trunk
___________________________________________________________________
Name: bzr:revision-info
   - timestamp: 2010-05-04 14:20:41.698999882 -0400
committer: Mike Rylander <miker at esilibrary.com>
properties: 
	branch-nick: trunk

   + timestamp: 2010-05-06 15:49:25.437000036 -0400
committer: Mike Rylander <miker at esilibrary.com>
properties: 
	branch-nick: trunk

Name: bzr:file-ids
   - Open-ILS/web/js/dojo/openils/BibTemplate.js	13010 at dcc99617-32d9-48b4-a31d-7c20da2025e4:trunk%2FOpen-ILS%2Fweb%2Fjs%2Fdojo%2Fopenils%2FBibTemplate.js

   + Open-ILS/src/perlmods/OpenILS/Application/Storage/Driver/Pg/QueryParser.pm	15833 at dcc99617-32d9-48b4-a31d-7c20da2025e4:trunk%2FOpen-ILS%2Fsrc%2Fperlmods%2FOpenILS%2FApplication%2FStorage%2FDriver%2FPg%2FQueryParser.pm
Open-ILS/src/perlmods/OpenILS/Application/Storage/QueryParser.pm	15833 at dcc99617-32d9-48b4-a31d-7c20da2025e4:trunk%2FOpen-ILS%2Fsrc%2Fperlmods%2FOpenILS%2FApplication%2FStorage%2FQueryParser.pm

Name: bzr:revision-id:v4
   - 11741 phasefx at batrepo-20091014063041-ama3i5s87ziqohxo
11742 phasefx at batrepo-20091014063644-pn3a6urkw3uxgr6n
12108 phasefx at batrepo-20091120084700-lavt73oserscgalf
12166 jason at esilibrary.com-20091202233906-g8kh2kh3qmmz66r1
12184 jason at esilibrary.com-20091204161020-0dqezh01c05btffh
12198 jason at esilibrary.com-20091208140008-eofwdbn2u8dxk2kk
12199 jason at esilibrary.com-20091208155412-4qdzy8sgs51vm0yq
12215 jason at esilibrary.com-20091209133642-bp8mb3tc5vpoc1ij
12220 jason at esilibrary.com-20091209143447-i1st1to8ln4hhwyb
12231 jason at esilibrary.com-20091209221438-vv4crqppm8ajj3dr
12804 jason at esilibrary.com-20100324194046-jza2ic2dlpq8txhc
12946 miker at esilibrary.com-20100402183612-8xznj35wfohk7zyu
12955 miker at esilibrary.com-20100403141037-h8d57ryrmkkg9yhb
12971 miker at whirly-20100405202254-aztbsf3p3eey9e8e
12997 miker at esilibrary.com-20100408154146-zodwuxxizwf0y449
13010 miker at miker-msi-20100409021618-5f0ohbg5cgi5pai0
13014 miker at esilibrary.com-20100409135406-mitf09aw1srnps3g
13022 miker at esilibrary.com-20100412144909-fc4bx1n80ac0z8ox
13023 miker at esilibrary.com-20100412145629-92g9jts2k8yqsm38
13152 miker at esilibrary.com-20100503010126-67i6kclipxip27du
13153 miker at esilibrary.com-20100503010322-3ri56680p7bf4o26
13161 miker at esilibrary.com-20100504150623-34h9t5p64cd52swu
13163 miker at esilibrary.com-20100504180646-77rxefvetqkiyo3s
13164 miker at esilibrary.com-20100504182041-0s81n6j3dxb14hrk

   + 11741 phasefx at batrepo-20091014063041-ama3i5s87ziqohxo
11742 phasefx at batrepo-20091014063644-pn3a6urkw3uxgr6n
12108 phasefx at batrepo-20091120084700-lavt73oserscgalf
12166 jason at esilibrary.com-20091202233906-g8kh2kh3qmmz66r1
12184 jason at esilibrary.com-20091204161020-0dqezh01c05btffh
12198 jason at esilibrary.com-20091208140008-eofwdbn2u8dxk2kk
12199 jason at esilibrary.com-20091208155412-4qdzy8sgs51vm0yq
12215 jason at esilibrary.com-20091209133642-bp8mb3tc5vpoc1ij
12220 jason at esilibrary.com-20091209143447-i1st1to8ln4hhwyb
12231 jason at esilibrary.com-20091209221438-vv4crqppm8ajj3dr
12804 jason at esilibrary.com-20100324194046-jza2ic2dlpq8txhc
12946 miker at esilibrary.com-20100402183612-8xznj35wfohk7zyu
12955 miker at esilibrary.com-20100403141037-h8d57ryrmkkg9yhb
12971 miker at whirly-20100405202254-aztbsf3p3eey9e8e
12997 miker at esilibrary.com-20100408154146-zodwuxxizwf0y449
13010 miker at miker-msi-20100409021618-5f0ohbg5cgi5pai0
13014 miker at esilibrary.com-20100409135406-mitf09aw1srnps3g
13022 miker at esilibrary.com-20100412144909-fc4bx1n80ac0z8ox
13023 miker at esilibrary.com-20100412145629-92g9jts2k8yqsm38
13152 miker at esilibrary.com-20100503010126-67i6kclipxip27du
13153 miker at esilibrary.com-20100503010322-3ri56680p7bf4o26
13161 miker at esilibrary.com-20100504150623-34h9t5p64cd52swu
13163 miker at esilibrary.com-20100504180646-77rxefvetqkiyo3s
13164 miker at esilibrary.com-20100504182041-0s81n6j3dxb14hrk
13175 miker at esilibrary.com-20100506194925-xg5folqttvehr2np

Name: bzr:text-parents
   - 
   + Open-ILS/src/perlmods/OpenILS/Application/Storage/Driver/Pg/QueryParser.pm	miker at esilibrary.com-20100504150623-34h9t5p64cd52swu
Open-ILS/src/perlmods/OpenILS/Application/Storage/QueryParser.pm	miker at miker-msi-20100409021618-5f0ohbg5cgi5pai0


Modified: trunk/Open-ILS/src/perlmods/OpenILS/Application/Storage/Driver/Pg/QueryParser.pm
===================================================================
--- trunk/Open-ILS/src/perlmods/OpenILS/Application/Storage/Driver/Pg/QueryParser.pm	2010-05-06 18:56:46 UTC (rev 16399)
+++ trunk/Open-ILS/src/perlmods/OpenILS/Application/Storage/Driver/Pg/QueryParser.pm	2010-05-06 19:49:25 UTC (rev 16400)
@@ -376,6 +376,8 @@
 #-------------------------------
 package OpenILS::Application::Storage::Driver::Pg::QueryParser::query_plan;
 use base 'QueryParser::query_plan';
+use OpenSRF::Utils::Logger qw($logger);
+use Data::Dumper;
 
 sub toSQL {
     my $self = shift;
@@ -401,6 +403,8 @@
     $self->QueryParser->superpage_size($filters{superpage_size}) if ($filters{superpage_size});
     $self->QueryParser->core_limit($filters{core_limit}) if ($filters{core_limit});
 
+    $logger->debug("Query plan:\n".Dumper($self));
+
     my $flat_plan = $self->flatten;
 
     # generate the relevance ranking
@@ -586,7 +590,7 @@
     my $self = shift;
 
     my $from = shift || '';
-    my $where = shift || '';
+    my $where = shift || '(';
 
     my @rank_list;
     for my $node ( @{$self->query_nodes} ) {
@@ -676,7 +680,7 @@
         }
     }
 
-    return { rank_list => \@rank_list, from => $from, where => $where };
+    return { rank_list => \@rank_list, from => $from, where => $where.')' };
 
 }
 

Modified: trunk/Open-ILS/src/perlmods/OpenILS/Application/Storage/QueryParser.pm
===================================================================
--- trunk/Open-ILS/src/perlmods/OpenILS/Application/Storage/QueryParser.pm	2010-05-06 18:56:46 UTC (rev 16399)
+++ trunk/Open-ILS/src/perlmods/OpenILS/Application/Storage/QueryParser.pm	2010-05-06 19:49:25 UTC (rev 16400)
@@ -586,13 +586,19 @@
 
             $last_type = '';
         } elsif ($self->search_class_count && /$search_class_re/) { # changing current class
+
+            if ($last_type eq 'CLASS') {
+                $struct->remove_last_node( $current_class );
+                warn "Encountered class change with no searches!\n" if $self->debug;
+            }
+
             warn "Encountered class change: $1\n" if $self->debug;
 
             $current_class = $1;
             $struct->classed_node( $current_class );
             $_ = $';
 
-            $last_type = '';
+            $last_type = 'CLASS';
         } elsif (/^\s*"([^"]+)"/) { # phrase, always anded
             warn "Encountered phrase: $1\n" if $self->debug;
 
@@ -776,6 +782,16 @@
     return $node;
 }
 
+sub remove_last_node {
+    my $self = shift;
+    my $requested_class = shift;
+
+    my $old = pop(@{$self->query_nodes});
+    pop(@{$self->query_nodes}) if (@{$self->query_nodes});
+
+    return $old;
+}
+
 sub query_nodes {
     my $self = shift;
     return $self->{query};



More information about the open-ils-commits mailing list