From add86f9507cafc40ff729d3afaa838e6186a86eb Mon Sep 17 00:00:00 2001 From: Adam Dickmeiss Date: Fri, 4 Sep 2015 14:26:12 +0200 Subject: [PATCH] Fix virt_db creates result-set for failed search MP-627 --- src/filter_virt_db.cpp | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) 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(); } -- 1.7.10.4