X-Git-Url: http://git.indexdata.com/?p=simpleserver-moved-to-github.git;a=blobdiff_plain;f=SimpleServer.xs;h=f0c07c35466ad77eeaf893cebe24fc93e40bf0cb;hp=f7bff318bfda0a31301a3ad9e074226266d2e0a1;hb=ad2e305a6ccfe200d3d26ce9441cbbdc189ebf82;hpb=2d821ce720fb65ebb82614c6f15176337c532990 diff --git a/SimpleServer.xs b/SimpleServer.xs index f7bff31..f0c07c3 100644 --- a/SimpleServer.xs +++ b/SimpleServer.xs @@ -885,6 +885,18 @@ static void f_SV_to_FacetList(SV *sv, Z_OtherInformation **oip, ODR odr) } } +static HV *parse_extra_args(Z_SRW_extra_arg *args) +{ + HV *href = newHV(); + + for (; args; args = args->next) + { + hv_store(href, args->name, strlen(args->name), + newSVpv(args->value, 0), 0); + } + return href; +} + int bend_search(void *handle, bend_search_rr *rr) { HV *href; @@ -918,6 +930,7 @@ int bend_search(void *handle, bend_search_rr *rr) } #endif href = newHV(); + hv_store(href, "SETNAME", 7, newSVpv(rr->setname, 0), 0); if (rr->srw_sortKeys && *rr->srw_sortKeys) hv_store(href, "SRW_SORTKEYS", 12, newSVpv(rr->srw_sortKeys, 0), 0); @@ -930,6 +943,8 @@ int bend_search(void *handle, bend_search_rr *rr) hv_store(href, "HANDLE", 6, zhandle->handle, 0); hv_store(href, "PID", 3, newSViv(getpid()), 0); hv_store(href, "PRESENT_NUMBER", 14, newSViv(rr->present_number), 0); + hv_store(href, "EXTRA_ARGS", 10, + newRV( (SV*) parse_extra_args(rr->extra_args)), 0); if ((rpnSV = zquery2perl(rr->query)) != 0) { hv_store(href, "RPN", 3, rpnSV, 0); } @@ -1411,7 +1426,6 @@ int bend_scan(void *handle, bend_scan_rr *rr) AV *list; AV *entries; HV *scan_item; - struct scan_entry *scan_list; struct scan_entry *buffer; int *step_size = rr->step_size; int scan_list_size = rr->num_entries; @@ -1459,6 +1473,8 @@ int bend_scan(void *handle, bend_scan_rr *rr) hv_store(href, "HANDLE", 6, zhandle->handle, 0); hv_store(href, "STATUS", 6, newSViv(BEND_SCAN_SUCCESS), 0); hv_store(href, "ENTRIES", 7, newRV((SV *) list), 0); + hv_store(href, "EXTRA_ARGS", 10, + newRV( (SV*) parse_extra_args(rr->extra_args)), 0); aref = newAV(); basenames = rr->basenames; for (i = 0; i < rr->num_bases; i++) @@ -1512,19 +1528,7 @@ int bend_scan(void *handle, bend_scan_rr *rr) rr->errcode = SvIV(err_code); rr->num_entries = SvIV(number); rr->status = SvIV(status); - if (yaz_version(NULL, NULL) >= 0x4022c && - rr->num_entries <= scan_list_size) - { - /* entries has been initialized by yaz and is big enough - to hold all entries */ - scan_list = rr->entries; - } - else - { - scan_list = (struct scan_entry *) - odr_malloc(rr->stream, rr->num_entries * sizeof(*scan_list)); - } - buffer = scan_list; + buffer = rr->entries; entries = (AV *)SvRV(entries_ref); if (rr->errcode == 0) for (i = 0; i < rr->num_entries; i++) { @@ -1543,7 +1547,6 @@ int bend_scan(void *handle, bend_scan_rr *rr) buffer++; hv_undef(scan_item); } - rr->entries = scan_list; zhandle->handle = point; handle = zhandle;