[open-ils-commits] [GIT] Evergreen ILS branch master updated. d8d832489f054bfba51854354ae00d7a26edc237

Evergreen Git git at git.evergreen-ils.org
Mon Feb 25 11:42:33 EST 2013


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, master has been updated
       via  d8d832489f054bfba51854354ae00d7a26edc237 (commit)
       via  976b9a9eae2343e0557592ff10c00c308dc6b530 (commit)
       via  e9de82db81f674ba9b92a864a5cd17492dc1a01d (commit)
       via  3a7baccb538efdf1ba6d5d7a13278a2716f5597b (commit)
      from  4ec48609ef5eb82b571b82e8ab5dc83109b63401 (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 d8d832489f054bfba51854354ae00d7a26edc237
Author: Thomas Berezansky <tsbere at mvlc.org>
Date:   Wed Feb 20 12:26:01 2013 -0500

    QueryParser: Improve container searches
    
    Add a with/from set for containers for record limiting instead of using the
    EXISTS methodology for better index usage.
    
    Signed-off-by: Thomas Berezansky <tsbere at mvlc.org>
    Signed-off-by: Ben Shum <bshum at biblio.org>

diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/Driver/Pg/QueryParser.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/Driver/Pg/QueryParser.pm
index e11aa0d..57558e5 100644
--- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/Driver/Pg/QueryParser.pm
+++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/Driver/Pg/QueryParser.pm
@@ -1229,36 +1229,35 @@ sub flatten {
                     if ($class) {
                         my ($u,$e) = $apputils->checksesperm($token) if ($token);
                         $perm_join = ' OR c.owner = ' . $u->id if ($u && !$e);
-                        $where .= $joiner if $where ne '';
-                        my $spcdepth = $self->plan_level + 5;
-                        if($class eq 'copy') {
-                            $spcdepth += 1;
-                            $where .= "(\n" . ${spc} x $spcdepth;
-                        }
-                        $where .= "${NOT}EXISTS(\n"
-                               . ${spc} x ($spcdepth + 1) . "SELECT 1 FROM container.${class}_bucket_item ci\n"
-                               . ${spc} x ($spcdepth + 4) . "JOIN container.${class}_bucket c ON (c.id = ci.bucket) $rec_join\n"
-                               . ${spc} x ($spcdepth + 1) . "WHERE c.btype = " . $self->QueryParser->quote_value($ctype) . "\n"
-                               . ${spc} x ($spcdepth + 4) . "AND c.id = " . $self->QueryParser->quote_value($cid) . "\n"
-                               . ${spc} x ($spcdepth + 4) . "AND (c.pub IS TRUE$perm_join)\n"
-                               . ${spc} x ($spcdepth + 4) . "AND $rec_field = m.source\n"
-                               . ${spc} x ($spcdepth + 1) . "LIMIT 1\n"
-                               . ${spc} x $spcdepth . ")";
+
+                        my $filter_alias = "$filter";
+                        $filter_alias =~ s/^.*\(0(x[0-9a-fA-F]+)\)$/$1/go;
+                        $filter_alias =~ s/\|/_/go;
+
+                        $with .= ",\n     " if $with;
+                        $with .= "container_${filter_alias} AS (\n";
+                        $with .= "       SELECT $rec_field AS record FROM container.${class}_bucket_item ci\n"
+                               . "             JOIN container.${class}_bucket c ON (c.id = ci.bucket) $rec_join\n"
+                               . "       WHERE c.btype = " . $self->QueryParser->quote_value($ctype) . "\n"
+                               . "             AND c.id = " . $self->QueryParser->quote_value($cid) . "\n"
+                               . "             AND (c.pub IS TRUE$perm_join)\n";
                         if ($class eq 'copy') {
-                            my $subjoiner = $filter->negate ? 'AND' : 'OR';
-                            $where .= "\n"
-                                   . ${spc} x ($spcdepth) . $subjoiner . "\n"
-                                   . ${spc} x ($spcdepth) . "${NOT}EXISTS(\n"
-                                   . ${spc} x ($spcdepth + 1) . "SELECT 1 FROM container.copy_bucket_item ci\n"
-                                   . ${spc} x ($spcdepth + 4) . "JOIN container.copy_bucket c ON (c.id = ci.bucket)\n"
-                                   . ${spc} x ($spcdepth + 4) . "JOIN biblio.peer_bib_copy_map pr ON ci.target_copy = pr.target_copy\n"
-                                   . ${spc} x ($spcdepth + 1) . "WHERE c.btype = " . $self->QueryParser->quote_value($cid) . "\n"
-                                   . ${spc} x ($spcdepth + 4) . "AND (c.pub IS TRUE$perm_join)\n"
-                                   . ${spc} x ($spcdepth + 4) . "AND pr.peer_record = m.source\n"
-                                   . ${spc} x ($spcdepth + 1) . "LIMIT 1\n"
-                                   . ${spc} x $spcdepth . ")\n"
-                                   . ${spc} x ($spcdepth - 1) . ")";
+                            $with .= "       UNION\n"
+                                   . "       SELECT pr.peer_record AS record FROM container.copy_bucket_item ci\n"
+                                   . "             JOIN container.copy_bucket c ON (c.id = ci.bucket)\n"
+                                   . "             JOIN biblio.peer_bib_copy_map pr ON ci.target_copy = pr.target_copy\n"
+                                   . "       WHERE c.btype = " . $self->QueryParser->quote_value($ctype) . "\n"
+                                   . "             AND c.id = " . $self->QueryParser->quote_value($cid) . "\n"
+                                   . "             AND (c.pub IS TRUE$perm_join)\n";
                         }
+                        $with .= "     )";
+
+                        $from .= "\n" . ${spc} x 3 . "LEFT JOIN container_${filter_alias} ON container_${filter_alias}.record = m.source";
+
+                        my $spcdepth = $self->plan_level + 5;
+
+                        $where .= $joiner if $where ne '';
+                        $where .= "${NOT}(container_${filter_alias} IS NOT NULL)";
                     }
                 }
             } elsif ($filter->name eq 'record_list') {

commit 976b9a9eae2343e0557592ff10c00c308dc6b530
Author: Thomas Berezansky <tsbere at mvlc.org>
Date:   Tue Feb 19 11:42:08 2013 -0500

    QueryParser: Check for URIs in staff visibility
    
    Specifically, don't show staff records with no copies but with URIs unless the
    URIs are "in scope".
    
    Signed-off-by: Thomas Berezansky <tsbere at mvlc.org>
    Signed-off-by: Ben Shum <bshum at biblio.org>

diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/Driver/Pg/QueryParser.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/Driver/Pg/QueryParser.pm
index ff33c23..e11aa0d 100644
--- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/Driver/Pg/QueryParser.pm
+++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/Driver/Pg/QueryParser.pm
@@ -903,6 +903,16 @@ sub toSQL {
                         AND pr.peer_record = m.source
                     LIMIT 1
                 )
+                AND
+                NOT EXISTS(
+                    SELECT 1 FROM asset.call_number acn
+                        JOIN asset.uri_call_number_map aucnm ON acn.id = aucnm.call_number
+                        JOIN asset.uri uri ON aucnm.uri = uri.id
+                    WHERE NOT acn.deleted
+                        AND uri.active
+                        AND acn.record = m.source
+                    LIMIT 1
+                )
             )
         SQL
     } else {

commit e9de82db81f674ba9b92a864a5cd17492dc1a01d
Author: Thomas Berezansky <tsbere at mvlc.org>
Date:   Tue Feb 19 11:39:40 2013 -0500

    QueryParser: Adjust visibility order
    
    Checking call number URIs last gives us a faster return on average based on
    finding copy information first.
    
    Signed-off-by: Thomas Berezansky <tsbere at mvlc.org>
    Signed-off-by: Ben Shum <bshum at biblio.org>

diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/Driver/Pg/QueryParser.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/Driver/Pg/QueryParser.pm
index 6e80ba4..ff33c23 100644
--- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/Driver/Pg/QueryParser.pm
+++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/Driver/Pg/QueryParser.pm
@@ -866,16 +866,6 @@ sub toSQL {
         AND (
             cbs.transcendant IS TRUE
             OR
-            EXISTS(
-                SELECT 1 FROM asset.call_number acn
-                    JOIN asset.uri_call_number_map aucnm ON acn.id = aucnm.call_number
-                    JOIN asset.uri uri ON aucnm.uri = uri.id
-                WHERE NOT acn.deleted AND uri.active AND acn.record = m.source AND acn.owning_lib IN (
-                    SELECT * FROM luri_org_list
-                )
-                LIMIT 1
-            )
-            OR
     SQL
     if ($self->find_modifier('staff')) {
         $limit_where .= <<"        SQL";
@@ -933,7 +923,19 @@ sub toSQL {
             )
         SQL
     }
-    $limit_where .= "        )";
+    $limit_where .= <<"    SQL";
+            OR
+            EXISTS(
+                SELECT 1 FROM asset.call_number acn
+                    JOIN asset.uri_call_number_map aucnm ON acn.id = aucnm.call_number
+                    JOIN asset.uri uri ON aucnm.uri = uri.id
+                WHERE NOT acn.deleted AND uri.active AND acn.record = m.source AND acn.owning_lib IN (
+                    SELECT * FROM luri_org_list
+                )
+                LIMIT 1
+            )
+        )
+    SQL
 
     # For single records we want the record id
     # For metarecords we want NULL or the only record ID.

commit 3a7baccb538efdf1ba6d5d7a13278a2716f5597b
Author: Thomas Berezansky <tsbere at mvlc.org>
Date:   Sat Feb 16 19:03:27 2013 -0500

    QueryParser: Provide null rank query as default
    
    If a given node contains only negative atoms the rank query was coming out as
    an empty string, which was generating bad SQL. This causes the default to be a
    null tsquery instead.
    
    Signed-off-by: Thomas Berezansky <tsbere at mvlc.org>
    Signed-off-by: Ben Shum <bshum at biblio.org>

diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/Driver/Pg/QueryParser.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/Driver/Pg/QueryParser.pm
index 8914bd1..6e80ba4 100644
--- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/Driver/Pg/QueryParser.pm
+++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/Driver/Pg/QueryParser.pm
@@ -1559,6 +1559,7 @@ sub tsquery_rank {
         push @atomlines, "\n" . ${spc} x 3 . $atom->sql;
     }
     $self->{tsquery_rank} = join(' ||', @atomlines);
+    $self->{tsquery_rank} = 'NULL::tsquery' unless $self->{tsquery_rank};
     return $self->{tsquery_rank};
 }
 

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

Summary of changes:
 .../Application/Storage/Driver/Pg/QueryParser.pm   |   90 +++++++++++---------
 1 files changed, 51 insertions(+), 39 deletions(-)


hooks/post-receive
-- 
Evergreen ILS


More information about the open-ils-commits mailing list