X-Git-Url: http://git.indexdata.com/?p=yaz-moved-to-github.git;a=blobdiff_plain;f=include%2Fyaz%2Ffacet.h;h=6ce1744e35ac2d0d52e7ec62e160bc74c7b82834;hp=cd34496f775971d1971e8ad6e752a2974e3bb9b6;hb=aab0b586a68a6d8df06b045d8043b434c0234bea;hpb=12eae66114708ddcbb8e70add6ec6b46db822cb9 diff --git a/include/yaz/facet.h b/include/yaz/facet.h index cd34496..6ce1744 100644 --- a/include/yaz/facet.h +++ b/include/yaz/facet.h @@ -1,5 +1,5 @@ /* This file is part of the YAZ toolkit. - * Copyright (C) 1995-2010 Index Data. + * Copyright (C) Index Data. * All rights reserved. * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: @@ -41,66 +41,64 @@ YAZ_BEGIN_CDECL - /* * Helper function for extracting facet values from the ASN structures. * */ -/* A helper structure to extract all the attribute stuff - from one Z_AttributesList. The pointers will all be to +/** A helper structure to extract all the attribute stuff + from one Z_AttributesList for facets. The pointers will all be to the Z-structures, or to constants, so there is no need to worry about freeing them */ -struct attrvalues { +struct yaz_facet_attr { int errcode; /* set in case of errors */ char *errstring; /* opt */ const char *useattr; /* @attr 1, from a string attr */ /* or number converted to a string */ /* defaults to 'any' */ char useattrbuff[30]; /* for converting numbers to strings */ - char *relation; /* @attr 2, defaults to '=' */ - int limit; /* for facet attributes */ + int sortorder; + int limit; + int start; }; YAZ_EXPORT -void facet_struct_init(struct attrvalues *attr_values); - -/* Use attribute, @attr1, can be numeric or string */ -YAZ_EXPORT -void useattr ( Z_AttributeElement *ae, struct attrvalues *av ); +void yaz_facet_attr_init(struct yaz_facet_attr *attr_values); YAZ_EXPORT -void relationattr ( Z_AttributeElement *ae, struct attrvalues *av ); +void yaz_facet_attr_get_z_attributes(const Z_AttributeList *attributes, + struct yaz_facet_attr *av); YAZ_EXPORT -void limitattr ( Z_AttributeElement *ae, struct attrvalues *av ); +Z_FacetTerm *facet_term_create_cstr(ODR odr, const char *cstr, Odr_int freq); YAZ_EXPORT -void limitattr ( Z_AttributeElement *ae, struct attrvalues *av ); +Z_FacetField* facet_field_create(ODR odr, Z_AttributeList *attributes, + int num_terms); YAZ_EXPORT -void facetattrs( Z_AttributeList *attributes, struct attrvalues *av ); +void facet_field_term_set(ODR odr, Z_FacetField *field, + Z_FacetTerm *facetTerm, int index); YAZ_EXPORT -Z_FacetList *extract_facet_request(ODR odr, Z_OtherInformation *search_input); +Z_FacetList* facet_list_create(ODR odr, int num_facets); YAZ_EXPORT -Z_Term *term_create(ODR odr, const char *cstr); - +void facet_list_field_set(ODR odr, Z_FacetList *list, Z_FacetField *field, + int index); YAZ_EXPORT -Z_FacetTerm* facet_term_create(ODR odr, Z_Term *term, int freq); +void yaz_oi_set_facetlist( + Z_OtherInformation **otherInformation, ODR odr, Z_FacetList *facet_list); YAZ_EXPORT -Z_FacetField* facet_field_create(ODR odr, Z_AttributeList *attributes, int num_terms); +Z_FacetList *yaz_oi_get_facetlist(Z_OtherInformation **otherInformation); YAZ_EXPORT -void facet_field_term_set(ODR odr, Z_FacetField *field, Z_FacetTerm *facetTerm, int index); +void yaz_oi_set_facetlist(Z_OtherInformation **otherInformation, ODR odr, + Z_FacetList *facet_list); -YAZ_EXPORT -Z_FacetList* facet_list_create(ODR odr, int num_facets); -YAZ_EXPORT -void facet_list_field_set(ODR odr, Z_FacetList *list, Z_FacetField *field, int index); +YAZ_END_CDECL #endif /*