/* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2012 Index Data
+ * Copyright (C) 1995-2013 Index Data
* See the file LICENSE for details.
*/
/**
#include <yaz/log.h>
#include <yaz/pquery.h>
-void handle_facet_list(ZOOM_resultset r, Z_FacetList *fl);
-
#if YAZ_HAVE_XML2
static void set_SRU_error(ZOOM_connection c, Z_SRW_diagnostic *d)
{
static zoom_ret send_srw(ZOOM_connection c, Z_SRW_PDU *sr)
{
Z_GDU *gdu;
- ZOOM_Event event;
const char *database = ZOOM_options_get(c->options, "databaseName");
gdu = z_get_HTTP_Request_uri(c->odr_out, c->host_port,
{
yaz_solr_encode_request(gdu->u.HTTP_Request, sr, c->odr_out, c->charset);
}
- if (!z_GDU(c->odr_out, &gdu, 0, 0))
- return zoom_complete;
- if (c->odr_print)
- z_GDU(c->odr_print, &gdu, 0, 0);
- if (c->odr_save)
- z_GDU(c->odr_save, &gdu, 0, 0);
- c->buf_out = odr_getbuf(c->odr_out, &c->len_out, 0);
-
- event = ZOOM_Event_create(ZOOM_EVENT_SEND_APDU);
- ZOOM_connection_put_event(c, event);
- odr_reset(c->odr_out);
- return ZOOM_send_buf(c);
+ return ZOOM_send_GDU(c, gdu);
}
#endif
c->tasks->u.search.recv_search_fired = 1;
}
if (res->facetList)
- handle_facet_list(resultset, res->facetList);
+ ZOOM_handle_facet_list(resultset, res->facetList);
break;
case ZOOM_TASK_RETRIEVE:
resultset = c->tasks->u.retrieve.resultset;
}
for (i = 0; i<res->num_records; i++)
{
- int pos;
+ int pos = *start + i;
Z_SRW_record *sru_rec;
Z_SRW_diagnostic *diag = 0;
int num_diag;
Z_NamePlusRecord *npr = (Z_NamePlusRecord *)
odr_malloc(c->odr_in, sizeof(Z_NamePlusRecord));
- /* recordPosition is 1 based */
+ /* only trust recordPosition if >= calculated position */
if (res->records[i].recordPosition &&
- *res->records[i].recordPosition > 0)
+ *res->records[i].recordPosition >= pos + 1)
pos = *res->records[i].recordPosition - 1;
- else
- pos = *start + i;
sru_rec = &res->records[i];
Z_SRW_PDU *sr;
ret = yaz_solr_decode_response(c->odr_in, hres, &sr);
if (ret == 0)
+ {
if (sr->which == Z_SRW_searchRetrieve_response)
*cret = handle_srw_response(c, sr->u.response);
+ else if (sr->which == Z_SRW_scan_response)
+ handle_srw_scan_response(c, sr->u.scan_response);
+ }
}
else
{
Z_SOAP *soap_package = 0;
ODR o = c->odr_in;
Z_SOAP_Handler soap_handlers[3] = {
- {YAZ_XMLNS_SRU_v1_1, 0, (Z_SOAP_fun) yaz_srw_codec},
+ {YAZ_XMLNS_SRU_v1_response, 0, (Z_SOAP_fun) yaz_srw_codec},
{YAZ_XMLNS_SRU_v2_response, 0, (Z_SOAP_fun) yaz_srw_codec},
{0, 0, 0}
};