X-Git-Url: http://git.indexdata.com/?p=yaz-moved-to-github.git;a=blobdiff_plain;f=src%2Fzoom-sru.c;h=0185e68b23e6fb400e826882b8296eae00ce8b3f;hp=142051f09d17893b06107329ed50bb951e19cab4;hb=05193e78a2553c93a61da19a39e1276b1a509bac;hpb=dd016baf50d8cd02a1a32d1fd10b5544cae6ff96 diff --git a/src/zoom-sru.c b/src/zoom-sru.c index 142051f..0185e68 100644 --- a/src/zoom-sru.c +++ b/src/zoom-sru.c @@ -145,7 +145,6 @@ zoom_ret ZOOM_connection_srw_send_scan(ZOOM_connection c) #if YAZ_HAVE_XML2 zoom_ret ZOOM_connection_srw_send_search(ZOOM_connection c) { - const char *facets = 0; int i; int *start, *count; ZOOM_resultset resultset = 0; @@ -166,13 +165,13 @@ zoom_ret ZOOM_connection_srw_send_search(ZOOM_connection c) ZOOM_memcached_search(c, resultset); if (!resultset->setname) - resultset->setname = xstrdup("default"); + resultset->setname = odr_strdup(resultset->odr, "default"); ZOOM_options_set(resultset->options, "setname", resultset->setname); start = &c->tasks->u.search.start; count = &c->tasks->u.search.count; - facets = ZOOM_options_get(resultset->options, "facets"); - if (facets) - facet_list = yaz_pqf_parse_facet_list(c->odr_out, facets); + if (resultset->req_facets) + facet_list = yaz_pqf_parse_facet_list(c->odr_out, + resultset->req_facets); schema = c->tasks->u.search.schema; if (resultset->live_set) @@ -295,8 +294,33 @@ static zoom_ret handle_srw_response(ZOOM_connection c, { if (res->numberOfRecords) { + Z_OtherInformation *oi = 0; + if (res->facetList) + { + ODR o = c->odr_in; + Z_External *ext = (Z_External *) + odr_malloc(o, sizeof(*ext)); + + ext->which = Z_External_userFacets; + ext->u.facetList = res->facetList; + ext->direct_reference = + odr_oiddup(o, yaz_oid_userinfo_facet_1); + ext->indirect_reference = 0; + ext->descriptor = 0; + oi = (Z_OtherInformation *) odr_malloc(o, sizeof(*oi)); + oi->num_elements = 1; + oi->list = (Z_OtherInformationUnit **) + odr_malloc(o, sizeof(*oi->list)); + oi->list[0] = (Z_OtherInformationUnit *) + odr_malloc(o, sizeof(**oi->list)); + oi->list[0]->category = 0; + oi->list[0]->which = Z_OtherInfo_externallyDefinedInfo; + oi->list[0]->information.externallyDefinedInfo = ext; + } resultset->size = *res->numberOfRecords; - ZOOM_memcached_hitcount(c, resultset); + ZOOM_memcached_hitcount(c, resultset, oi, + res->resultCountPrecision ? + res->resultCountPrecision : "exact"); } resultset->live_set = 2; if (res->suggestions)