added config option for defining the downloaded record format for each Z source
authorerickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Tue, 18 Mar 2008 14:25:49 +0000 (14:25 +0000)
committererickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Tue, 18 Mar 2008 14:25:49 +0000 (14:25 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@9069 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/examples/opensrf.xml.example
Open-ILS/src/perlmods/OpenILS/Application/Search/Z3950.pm

index 1d7e936..3d9724d 100644 (file)
@@ -96,6 +96,8 @@ vim:et:ts=4:sw=4:
                     <host>z3950.loc.gov</host>
                     <port>7090</port>
                     <db>Voyager</db>
+                    <!-- fetch the full record with no holdings. FI is the default -->
+                    <record_format>FI</record_format> 
                     <attrs>
                         <tcn><code>12</code><format>1</format></tcn>
                         <isbn><code>7</code><format>6</format></isbn>
index db09995..9d84c18 100755 (executable)
@@ -145,7 +145,7 @@ sub do_class_search {
                my $ev = $connections[$index - 1]->last_event();
                $logger->debug("z3950: Received event $ev");
                if ($ev == OpenILS::Utils::ZClient::EVENT_END()) {
-                       my $munged = process_results( $results[$index - 1], $$args{limit}, $$args{offset} );
+                       my $munged = process_results( $results[$index - 1], $$args{limit}, $$args{offset}, $$args{service}[$index -1] );
                        $$munged{service} = $$args{service}[$index - 1];
                        $conn->respond($munged);
                }
@@ -167,9 +167,9 @@ sub do_service_search {
        
        my $info = $services{$$args{service}};
 
-       $$args{host}    = $$info{host},
-       $$args{port}    = $$info{port},
-       $$args{db}              = $$info{db},
+       $$args{host}    = $$info{host};
+       $$args{port}    = $$info{port};
+       $$args{db}              = $$info{db};
 
        return do_search( $self, $conn, $auth, $args );
 }
@@ -238,7 +238,7 @@ sub do_search {
 
        return {result => $results, connection => $connection} if ($async);
 
-       my $munged = process_results($results, $limit, $offset);
+       my $munged = process_results($results, $limit, $offset, $$args{service});
        $munged->{query} = $query;
 
        return $munged;
@@ -253,8 +253,11 @@ sub process_results {
        my $results     = shift;
        my $limit       = shift || 10;
        my $offset      = shift || 0;
+    my $service = shift;
 
-       $results->option(elementSetName => "FI"); # full records with no holdings
+    my $rformat = $services{$service}->{record_format} || 'FI';
+       $results->option(elementSetName => $rformat);
+    $logger->info("z3950: using record format '$rformat'");
 
        my @records;
        my $res = {};