X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=src%2Fzoom-sru.c;h=b0a008b0817467ee10a89633fb868cb65b98a04e;hb=bbbc5ceb43ac100efb9e193fd87d364c18e77f7b;hp=87de7c33f8f0617c2770e03f1bbc01ab20259594;hpb=00537b483d646bd04a204708ecbde708861f044e;p=yaz-moved-to-github.git diff --git a/src/zoom-sru.c b/src/zoom-sru.c index 87de7c3..b0a008b 100644 --- a/src/zoom-sru.c +++ b/src/zoom-sru.c @@ -1,5 +1,5 @@ /* 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. */ /** @@ -34,7 +34,6 @@ 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, @@ -57,18 +56,7 @@ static zoom_ret send_srw(ZOOM_connection c, Z_SRW_PDU *sr) { 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 @@ -313,7 +301,7 @@ static zoom_ret handle_srw_response(ZOOM_connection c, } for (i = 0; inum_records; i++) { - int pos; + int pos = *start + i; Z_SRW_record *sru_rec; Z_SRW_diagnostic *diag = 0; int num_diag; @@ -321,12 +309,10 @@ static zoom_ret handle_srw_response(ZOOM_connection c, 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];