[open-ils-commits] r13026 - trunk/Open-ILS/src/perlmods/OpenILS/WWW (dbs)

svn at svn.open-ils.org svn at svn.open-ils.org
Thu Apr 30 20:30:45 EDT 2009


Author: dbs
Date: 2009-04-30 20:30:44 -0400 (Thu, 30 Apr 2009)
New Revision: 13026

Modified:
   trunk/Open-ILS/src/perlmods/OpenILS/WWW/SuperCat.pm
Log:
Enable org_unit-scoped SRU searches

http://example.com/opac/extras/sru/SHORTNAME will set a search scope
of SHORTNAME if the search string does not already contain a site:
parameter

Combined with simple2zoom configuration, this gives us the ability to
surface different Z39.50 "databases" that correspond to various org_units.


Modified: trunk/Open-ILS/src/perlmods/OpenILS/WWW/SuperCat.pm
===================================================================
--- trunk/Open-ILS/src/perlmods/OpenILS/WWW/SuperCat.pm	2009-04-30 20:47:35 UTC (rev 13025)
+++ trunk/Open-ILS/src/perlmods/OpenILS/WWW/SuperCat.pm	2009-05-01 00:30:44 UTC (rev 13026)
@@ -1599,10 +1599,20 @@
     my $req = SRU::Request->newFromCGI( $cgi );
     my $resp = SRU::Response->newFromRequest( $req );
 
+    # Find the org_unit shortname, if passed as part of the URL
+    # http://example.com/opac/extras/sru/SHORTNAME
+    my $url = $cgi->path_info;
+    my ($shortname) = $url =~ m#/?(.*)#;
+
     if ( $resp->type eq 'searchRetrieve' ) {
 		my $cql_query = $req->query;
 		my $search_string = $req->cql->toEvergreen;
 
+		# Ensure the search string overrides the default site
+        if ($shortname and $search_string !~ m#site:#) {
+                $search_string .= " site:$shortname";
+        }
+
         my $offset = $req->startRecord;
         $offset-- if ($offset);
         $offset ||= 0;
@@ -1762,3 +1772,5 @@
 }
 
 1;
+
+# vim: noet:ts=4:sw=4



More information about the open-ils-commits mailing list