Filter record_transform handles OPAC record.
authorAdam Dickmeiss <adam@indexdata.dk>
Sun, 16 Dec 2007 22:22:49 +0000 (22:22 +0000)
committerAdam Dickmeiss <adam@indexdata.dk>
Sun, 16 Dec 2007 22:22:49 +0000 (22:22 +0000)
etc/config-sru-to-z3950.xml
src/filter_record_transform.cpp

index b56cf1d..7ec98de 100644 (file)
@@ -1,5 +1,5 @@
 <?xml version="1.0"?>
-<!-- $Id: config-sru-to-z3950.xml,v 1.20 2007-03-07 22:17:51 adam Exp $ -->
+<!-- $Id: config-sru-to-z3950.xml,v 1.21 2007-12-16 22:22:49 adam Exp $ -->
 <metaproxy 
     xmlns="http://indexdata.com/metaproxy" 
     version="1.0">
             <xslt stylesheet="../xml/xslt/MARC21slim2DC.xsl"/>
           </backend>
         </retrieval>
+        <retrieval syntax="opac"/>
+        <retrieval syntax="xml" name="opac">
+          <backend syntax="opac" name="F">
+          <marc inputformat="marc" outputformat="marcxml"
+                inputcharset="marc-8"/>
+          </backend>
+        </retrieval>
         <retrieval syntax="usmarc">
           <backend syntax="usmarc" name="F">
           </backend>
index 23c4524..7449ab5 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: filter_record_transform.cpp,v 1.12 2007-05-09 21:23:09 adam Exp $
+/* $Id: filter_record_transform.cpp,v 1.13 2007-12-16 22:22:49 adam Exp $
    Copyright (c) 2005-2007, Index Data.
 
 This file is part of Metaproxy.
@@ -282,35 +282,44 @@ void yf::RecordTransform::Impl::process(mp::Package &package) const
                  = pr_res->records->u.databaseOrSurDiagnostics->records[i];
              if (npr->which == Z_NamePlusRecord_databaseRecord)
              {
+                 WRBUF output_record = wrbuf_alloc();
                  Z_External *r = npr->u.databaseRecord;
-                 //oident *ent = oid_getentbyoid(r->direct_reference);
-                 if (r->which == Z_External_octet) 
+                 int ret_trans = 0;
+                 if (r->which == Z_External_OPAC)
                  {
-                     WRBUF output_record = wrbuf_alloc();
-                     int ret_trans 
-                         =  yaz_record_conv_record(rc,
-                                                   (const char *)
-                                                   r->u.octet_aligned->buf, 
-                                                   r->u.octet_aligned->len,
-                                                   output_record);
-                     if (ret_trans == 0)
-                     {
-                         npr->u.databaseRecord =
-                             z_ext_record_oid(odr_en, match_syntax,
+#if YAZ_VERSIONL >= 0x030011
+                     ret_trans = 
+                         yaz_record_conv_opac_record(rc, r->u.opac,
+                                                     output_record);
+#else
+                     ;
+#endif
+                 }
+                 else if (r->which == Z_External_octet) 
+                 {
+                     ret_trans =
+                         yaz_record_conv_record(rc, (const char *)
+                                                r->u.octet_aligned->buf, 
+                                                r->u.octet_aligned->len,
+                                                output_record);
+                 }
+                 if (ret_trans == 0)
+                 {
+                     npr->u.databaseRecord =
+                         z_ext_record_oid(odr_en, match_syntax,
                                           wrbuf_buf(output_record),
                                           wrbuf_len(output_record));
-                     }
-                     else
-                     {
-                         pr_res->records->
-                             u.databaseOrSurDiagnostics->records[i] 
-                             =  zget_surrogateDiagRec(
-                                 odr_en, npr->databaseName,
-                                 YAZ_BIB1_SYSTEM_ERROR_IN_PRESENTING_RECORDS,
-                                 yaz_record_conv_get_error(rc));
-                     }
-                     wrbuf_destroy(output_record);
                  }
+                 else
+                 {
+                     pr_res->records->
+                         u.databaseOrSurDiagnostics->records[i] 
+                         =  zget_surrogateDiagRec(
+                             odr_en, npr->databaseName,
+                             YAZ_BIB1_SYSTEM_ERROR_IN_PRESENTING_RECORDS,
+                             yaz_record_conv_get_error(rc));
+                 }
+                 wrbuf_destroy(output_record);
              }
          }
     }