X-Git-Url: http://git.indexdata.com/?p=yaz-moved-to-github.git;a=blobdiff_plain;f=src%2Fzoom-sru.c;h=f688749e3c2e86de8955b769b78a39efc8a7d95d;hp=0776057ef831574e145d3a033a43ad5df3c8274e;hb=eeb3f9f3eb2b41f75341f5d93d0583bda80e5a07;hpb=c23b3002b19ba3fcc016eb3fab454f22e0ecacee diff --git a/src/zoom-sru.c b/src/zoom-sru.c index 0776057..f688749 100644 --- a/src/zoom-sru.c +++ b/src/zoom-sru.c @@ -108,15 +108,15 @@ zoom_ret ZOOM_connection_srw_send_scan(ZOOM_connection c) /* SRU scan can only carry CQL and PQF */ if (z_query->which == Z_Query_type_104) { - sr->u.scan_request->query_type = Z_SRW_query_type_cql; - sr->u.scan_request->scanClause.cql = + sr->u.scan_request->queryType = "cql"; + sr->u.scan_request->scanClause = odr_strdup(c->odr_out, ZOOM_query_get_query_string(scan->query)); } else if (z_query->which == Z_Query_type_1 || z_query->which == Z_Query_type_101) { - sr->u.scan_request->query_type = Z_SRW_query_type_pqf; - sr->u.scan_request->scanClause.pqf = + sr->u.scan_request->queryType = "pqf"; + sr->u.scan_request->scanClause = odr_strdup(c->odr_out, ZOOM_query_get_query_string(scan->query)); } else @@ -215,13 +215,13 @@ zoom_ret ZOOM_connection_srw_send_search(ZOOM_connection c) if (z_query->which == Z_Query_type_104 && z_query->u.type_104->which == Z_External_CQL) { - sr->u.request->query_type = Z_SRW_query_type_cql; - sr->u.request->query.cql = z_query->u.type_104->u.cql; + sr->u.request->queryType = "cql"; + sr->u.request->query = z_query->u.type_104->u.cql; } else if (z_query->which == Z_Query_type_1 && z_query->u.type_1) { - sr->u.request->query_type = Z_SRW_query_type_pqf; - sr->u.request->query.pqf = + sr->u.request->queryType = "pqf"; + sr->u.request->query = odr_strdup(c->odr_out, ZOOM_query_get_query_string(resultset->query)); } @@ -350,14 +350,10 @@ static zoom_ret handle_srw_response(ZOOM_connection c, npr->u.databaseRecord->indirect_reference = 0; npr->u.databaseRecord->which = Z_External_octet; - npr->u.databaseRecord->u.octet_aligned = (Odr_oct *) - odr_malloc(c->odr_in, sizeof(Odr_oct)); - npr->u.databaseRecord->u.octet_aligned->buf = (unsigned char*) - sru_rec->recordData_buf; - npr->u.databaseRecord->u.octet_aligned->len = - npr->u.databaseRecord->u.octet_aligned->size = - sru_rec->recordData_len; - + npr->u.databaseRecord->u.octet_aligned = + odr_create_Odr_oct(c->odr_in, + sru_rec->recordData_buf, + sru_rec->recordData_len); if (sru_rec->recordSchema && !strcmp(sru_rec->recordSchema, "info:srw/schema/1/diagnostics-v1.1")) @@ -439,9 +435,10 @@ int ZOOM_handle_sru(ZOOM_connection c, Z_HTTP_Response *hres, { Z_SOAP *soap_package = 0; ODR o = c->odr_in; - Z_SOAP_Handler soap_handlers[3] = { + Z_SOAP_Handler soap_handlers[4] = { {YAZ_XMLNS_SRU_v1_response, 0, (Z_SOAP_fun) yaz_srw_codec}, - {YAZ_XMLNS_SRU_v2_response, 0, (Z_SOAP_fun) yaz_srw_codec}, + {YAZ_XMLNS_SRU_v2_mask, 0, (Z_SOAP_fun) yaz_srw_codec}, + {"searchRetrieveResponse", 0, (Z_SOAP_fun) yaz_srw_codec}, {0, 0, 0} }; ret = z_soap_codec(o, &soap_package,