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

Evergreen Git git at git.evergreen-ils.org
Tue Jan 31 14:32:43 EST 2012


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  12a0c69da19bd323b13695e655116dc605d12cb8 (commit)
      from  d165b4ed70d06b4170f4e24cd75a2b31c6fdcc05 (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 12a0c69da19bd323b13695e655116dc605d12cb8
Author: Bill Erickson <berick at esilibrary.com>
Date:   Mon Jan 23 15:00:45 2012 -0500

    TPac: Avoid long-running, unintended empty searches
    
    If a page that executes a search is accessed with no viable search
    query, cut the search short to avoid meaningless, long-running searches.
    This primarily affects direct links to record detail pages.  For
    example:
    
    http://example.org/eg/opac/record/123
    
    The RD page attempts to load the currrently active search (for paging) and,
    if there is no query, will search for strings like 'site(BR1) depth(2)',
    which are unintended and quite slow, which delays page rendering.
    
    ---
    
    While we're in there, let's silence the following Apache error log
    warning by ensuring that int() gets a value.
    
    Use of uninitialized value in int at
    /usr/local/share/perl/5.10.1/OpenILS/WWW/EGCatLoader/Search.pm line 192.
    
    Signed-off-by: Bill Erickson <berick at esilibrary.com>
    Signed-off-by: Lebbeous Fogle-Weekley <lebbeous at esilibrary.com>

diff --git a/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Search.pm b/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Search.pm
index bce9cdb..b8907a6 100644
--- a/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Search.pm
+++ b/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Search.pm
@@ -70,18 +70,6 @@ sub _prepare_biblio_search {
         $query .= " $1($term)" if length $term;
     }
 
-    # sort is treated specially, even though it's actually a filter
-    if ($cgi->param('sort')) {
-        $query =~ s/sort\([^\)]*\)//g;  # override existing sort(). no stacking.
-        my ($axis, $desc) = split /\./, $cgi->param('sort');
-        $query .= " sort($axis)";
-        if ($desc and not $query =~ /\#descending/) {
-            $query .= '#descending';
-        } elsif (not $desc) {
-            $query =~ s/\#descending//;
-        }
-    }
-
     if ($cgi->param("bookbag")) {
         $query .= " container(bre,bookbag," . int($cgi->param("bookbag")) . ")";
     }
@@ -100,6 +88,23 @@ sub _prepare_biblio_search {
         }
     }
 
+    # ---------------------------------------------------------------------
+    # Nothing below here constitutes a query by itself.  If the query value 
+    # is still empty up to this point, there is no query.  abandon ship.
+    return () unless $query;
+
+    # sort is treated specially, even though it's actually a filter
+    if ($cgi->param('sort')) {
+        $query =~ s/sort\([^\)]*\)//g;  # override existing sort(). no stacking.
+        my ($axis, $desc) = split /\./, $cgi->param('sort');
+        $query .= " sort($axis)";
+        if ($desc and not $query =~ /\#descending/) {
+            $query .= '#descending';
+        } elsif (not $desc) {
+            $query =~ s/\#descending//;
+        }
+    }
+
     my $site;
     my $org = $ctx->{search_ou};
     if (defined($org) and $org ne '' and ($org ne $ctx->{aou_tree}->()->id) and not $query =~ /site\(\S+\)/) {
@@ -184,7 +189,7 @@ sub tag_circed_items {
 sub load_rresults_bookbag {
     my ($self) = @_;
 
-    my $bookbag_id = int($self->cgi->param("bookbag"));
+    my $bookbag_id = int($self->cgi->param("bookbag") || 0);
     return if $bookbag_id < 1;
 
     my %authz = $self->ctx->{"user"} ?

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

Summary of changes:
 .../perlmods/lib/OpenILS/WWW/EGCatLoader/Search.pm |   31 +++++++++++--------
 1 files changed, 18 insertions(+), 13 deletions(-)


hooks/post-receive
-- 
Evergreen ILS


More information about the open-ils-commits mailing list