X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=ztest%2Fztest.c;h=7ddb3c655877af83f71d2d568fdc5bbf09b8c26b;hb=95a0f8e6ad2f79820c7a3cf2248c5c904b41a1e6;hp=d5e5d2769fef96796f2858917b02b949ce2d65ca;hpb=be042bc51e825a53074dc1b586f1fff0a002ab0b;p=yaz-moved-to-github.git diff --git a/ztest/ztest.c b/ztest/ztest.c index d5e5d27..7ddb3c6 100644 --- a/ztest/ztest.c +++ b/ztest/ztest.c @@ -237,8 +237,8 @@ static void addterms(ODR odr, Z_FacetField *facet_field, const char *facet_name) for (index = 0; index < facet_field->num_terms; index++) { Z_Term *term; Z_FacetTerm *facet_term; - // sprintf(key, "%s%d", facet_name, index); - //yaz_log(YLOG_DEBUG, "facet add term %s %d %s", facet_name, index, key); + sprintf(key, "%s%d", facet_name, index); + yaz_log(YLOG_DEBUG, "facet add term %s %d %s", facet_name, index, key); term = term_create(odr, key); facet_term = facet_term_create(odr, term, freq); freq = freq - 10 ; @@ -254,9 +254,8 @@ Z_OtherInformation *build_facet_response(ODR odr, Z_FacetList *facet_list) { struct attrvalues attrvalues; facet_struct_init(&attrvalues); attrvalues.limit = 10; - yaz_log(YLOG_LOG, "Attributes: %s %s %d ", attrvalues.useattr, attrvalues.useattrbuff, attrvalues.limit); facetattrs(facet_list->elements[index]->attributes, &attrvalues); - yaz_log(YLOG_LOG, "Attributes: %s %s %d ", attrvalues.useattr, attrvalues.useattrbuff, attrvalues.limit); + yaz_log(YLOG_LOG, "Attributes: %s %d ", attrvalues.useattr, attrvalues.limit); if (attrvalues.errstring) yaz_log(YLOG_LOG, "Error parsing attributes: %s", attrvalues.errstring); if (attrvalues.limit > 0) { @@ -264,6 +263,10 @@ Z_OtherInformation *build_facet_response(ODR odr, Z_FacetList *facet_list) { addterms(odr, new_list->elements[new_index], attrvalues.useattr); new_index++; } + else { + yaz_log(YLOG_DEBUG, "Facet: skipping %s due to 0 limit.", attrvalues.useattr); + } + } new_list->num = new_index; if (new_index > 0) { @@ -275,6 +278,8 @@ Z_OtherInformation *build_facet_response(ODR odr, Z_FacetList *facet_list) { oiu->which = Z_OtherInfo_externallyDefinedInfo; oiu->information.externallyDefinedInfo = odr_malloc(odr, sizeof(*oiu->information.externallyDefinedInfo)); oiu->information.externallyDefinedInfo->direct_reference = odr_oiddup(odr, yaz_oid_userinfo_facet_1); + oiu->information.externallyDefinedInfo->descriptor = 0; + oiu->information.externallyDefinedInfo->indirect_reference = 0; oiu->information.externallyDefinedInfo->which = Z_External_userFacets; oiu->information.externallyDefinedInfo->u.facetList = new_list; oi->list[0] = oiu;