X-Git-Url: http://sru.miketaylor.org.uk/?a=blobdiff_plain;f=src%2Ffilter_sru_to_z3950.cpp;h=65481bdc7a31cd521545b019d52a3e6dcd56edb2;hb=f33e9f453cafd768594ff5fdada87e000bb909ae;hp=09b48b1859fd4b36476ef5da031e496bcd350e6c;hpb=6bd242f99846e3663a0551c6d18d6dedd7a94a38;p=metaproxy-moved-to-github.git diff --git a/src/filter_sru_to_z3950.cpp b/src/filter_sru_to_z3950.cpp index 09b48b1..65481bd 100644 --- a/src/filter_sru_to_z3950.cpp +++ b/src/filter_sru_to_z3950.cpp @@ -264,7 +264,8 @@ void yf::SRUtoZ3950::Impl::sru(mp::Package &package, Z_GDU *zgdu_req) { // searchRetrieve Z_SRW_searchRetrieveRequest *sr_req = sru_pdu_req->u.request; - sru_pdu_res = yaz_srw_get(odr_en, Z_SRW_searchRetrieve_response); + sru_pdu_res = yaz_srw_get_pdu(odr_en, Z_SRW_searchRetrieve_response, + sru_pdu_req->srw_version); // checking that we have a query ok = mp_util::check_sru_query_exists(package, odr_en, @@ -291,7 +292,8 @@ void yf::SRUtoZ3950::Impl::sru(mp::Package &package, Z_GDU *zgdu_req) else if (sru_pdu_req->which == Z_SRW_scan_request && sru_pdu_req->u.scan_request) { - sru_pdu_res = yaz_srw_get(odr_en, Z_SRW_scan_response); + sru_pdu_res = yaz_srw_get_pdu(odr_en, Z_SRW_scan_response, + sru_pdu_req->srw_version); // we do not do scan at the moment, therefore issuing a diagnostic yaz_add_srw_diagnostic(odr_en, @@ -778,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))