sru_z3950: relay surrogate diagnostics
authorAdam Dickmeiss <adam@indexdata.dk>
Wed, 12 Sep 2012 12:13:20 +0000 (14:13 +0200)
committerAdam Dickmeiss <adam@indexdata.dk>
Wed, 12 Sep 2012 12:13:20 +0000 (14:13 +0200)
src/filter_sru_to_z3950.cpp

index 4fdc80b..65481bd 100644 (file)
@@ -780,7 +780,26 @@ bool yf::SRUtoZ3950::Impl::z3950_present_request(
                 
                 sru_res->records[i + num].recordPacking = record_packing;
                 
-                if (npr->which == Z_NamePlusRecord_databaseRecord &&
+                if (npr->which == Z_NamePlusRecord_surrogateDiagnostic)
+                {
+                    Z_DiagRec *p = npr->u.surrogateDiagnostic;
+                    if (p->which == Z_DiagRec_defaultFormat)
+                    {
+                        Z_DefaultDiagFormat *df = p->u.defaultFormat;
+                        int c = yaz_diag_bib1_to_srw(*df->condition);
+
+                        yaz_mk_sru_surrogate(
+                            odr_en, sru_res->records + i + num, position,
+                            c, df->u.v2Addinfo);
+                    }
+                    else
+                    {
+                        yaz_mk_sru_surrogate(
+                            odr_en, sru_res->records + i + num, position,
+                            YAZ_SRW_RECORD_TEMPORARILY_UNAVAILABLE, 0);
+                    }
+                }
+                else if (npr->which == Z_NamePlusRecord_databaseRecord &&
                     npr->u.databaseRecord->direct_reference 
                     && !oid_oidcmp(npr->u.databaseRecord->direct_reference,
                                    yaz_oid_recsyn_xml))