X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=src%2Fzoom-sru.c;h=c38cee631dd41943efda78bfcff23bd6502c23ae;hb=f938f90db302b31bdd72b86ca3f9671c7199a4f1;hp=d52372f5a4f49fe9436ba1a899544c86b1f899cd;hpb=57cae124c6a1c7cdd8c70090db636b227887fc19;p=yaz-moved-to-github.git diff --git a/src/zoom-sru.c b/src/zoom-sru.c index d52372f..c38cee6 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-2011 Index Data + * Copyright (C) 1995-2012 Index Data * See the file LICENSE for details. */ /** @@ -61,6 +61,8 @@ static zoom_ret send_srw(ZOOM_connection c, Z_SRW_PDU *sr) 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); @@ -217,6 +219,13 @@ zoom_ret ZOOM_connection_srw_send_search(ZOOM_connection c) ZOOM_set_error(c, ZOOM_ERROR_UNSUPPORTED_QUERY, 0); return zoom_complete; } + + option_val = ZOOM_query_get_sru11(resultset->query); + if (option_val) + { + sr->u.request->sort_type = Z_SRW_sort_type_sort; + sr->u.request->sort.sortKeys = odr_strdup(c->odr_out, option_val); + } sr->u.request->startRecord = odr_intdup(c->odr_out, *start + 1); sr->u.request->maximumRecords = odr_intdup( c->odr_out, (resultset->step > 0 && resultset->step < *count) ? @@ -299,6 +308,9 @@ static zoom_ret handle_srw_response(ZOOM_connection c, if (res->numberOfRecords) { resultset->size = *res->numberOfRecords; } + if (res->suggestions) { + ZOOM_resultset_option_set(resultset, "suggestions", res->suggestions); + } for (i = 0; inum_records; i++) { int pos; @@ -308,10 +320,8 @@ static zoom_ret handle_srw_response(ZOOM_connection c, Z_NamePlusRecord *npr = (Z_NamePlusRecord *) odr_malloc(c->odr_in, sizeof(Z_NamePlusRecord)); - /* - * TODO This does not work with 0-based recordPositions. - * We will iterate over one twice - */ + + /* recordPosition is 1 based */ if (res->records[i].recordPosition && *res->records[i].recordPosition > 0) pos = *res->records[i].recordPosition - 1;