From: Adam Dickmeiss Date: Fri, 4 Sep 2015 12:26:12 +0000 (+0200) Subject: Fix virt_db creates result-set for failed search MP-627 X-Git-Tag: v1.9.3~1 X-Git-Url: http://lists.indexdata.dk/?a=commitdiff_plain;h=add86f9507cafc40ff729d3afaa838e6186a86eb;p=metaproxy-moved-to-github.git Fix virt_db creates result-set for failed search MP-627 --- diff --git a/src/filter_virt_db.cpp b/src/filter_virt_db.cpp index 6849917..11799d4 100644 --- a/src/filter_virt_db.cpp +++ b/src/filter_virt_db.cpp @@ -377,10 +377,20 @@ void yf::VirtualDB::Frontend::search(mp::Package &package, Z_APDU *apdu_req) package.session().close(); return; } - b->m_number_of_sets++; - m_sets[resultSetId] = VirtualDB::Set(b, backend_setname); - fixup_package(search_package, b); + Z_GDU *gdu = search_package.response().get(); + if (gdu && gdu->which == Z_GDU_Z3950 + && gdu->u.z3950->which == Z_APDU_searchResponse) + { + Z_SearchResponse *b_resp = gdu->u.z3950->u.searchResponse; + Z_Records *z_records = b_resp->records; + if (!z_records || (z_records && z_records->which == Z_Records_DBOSD)) + { + b->m_number_of_sets++; + m_sets[resultSetId] = VirtualDB::Set(b, backend_setname); + fixup_package(search_package, b); + } + } package.response() = search_package.response(); }