+
+ if (z_records)
+ {
+ int condition = 0;
+ if (z_records->which == Z_Records_NSD)
+ {
+ condition =
+ get_diagnostic(z_records->u.nonSurrogateDiagnostic);
+ }
+ else if (z_records->which == Z_Records_multipleNSD)
+ {
+ if (z_records->u.multipleNonSurDiagnostics->num_diagRecs >= 1
+ &&
+
+ z_records->u.multipleNonSurDiagnostics->diagRecs[0]->which ==
+ Z_DiagRec_defaultFormat)
+ {
+ condition = get_diagnostic(
+ z_records->u.multipleNonSurDiagnostics->diagRecs[0]->u.defaultFormat);
+
+ }
+ }
+ if (!session_restarted &&
+ condition == YAZ_BIB1_TEMPORARY_SYSTEM_ERROR)
+ {
+ bc->remove_backend(found_backend);
+ session_restarted = true;
+ found_backend.reset();
+ goto restart;
+
+ }
+
+ if (condition)
+ {
+ mp::odr odr;
+ if (apdu_req->which == Z_APDU_searchRequest)
+ {
+ Z_APDU *f_apdu = odr.create_searchResponse(apdu_req,
+ 0, 0);
+ Z_SearchResponse *f_resp = f_apdu->u.searchResponse;
+ *f_resp->searchStatus = Z_SearchResponse_none;
+ f_resp->records = z_records;
+ package.response() = f_apdu;
+ }
+ if (apdu_req->which == Z_APDU_presentRequest)
+ {
+ Z_APDU *f_apdu = odr.create_presentResponse(apdu_req,
+ 0, 0);
+ Z_PresentResponse *f_resp = f_apdu->u.presentResponse;
+ f_resp->records = z_records;
+ package.response() = f_apdu;
+ }
+ bc->release_backend(found_backend);
+ return; // search error
+ }
+ }
+ if (!session_restarted && new_set->m_result_set_size < 0)
+ {
+ bc->remove_backend(found_backend);
+ session_restarted = true;
+ found_backend.reset();
+ goto restart;
+ }
+