Update expected MARC result due to upd message
[yaz-moved-to-github.git] / include / yaz / facet.h
1
2 #ifndef YAZ_FACET_H
3 #define YAZ_FACET_H
4
5 #include <yaz/yconfig.h>
6 #include <yaz/odr.h>
7 #include <yaz/z-core.h>
8 #include <yaz/z-facet-1.h>
9 #include <yaz/log.h>
10
11 YAZ_BEGIN_CDECL
12
13
14 /*
15  * Helper function for extracting facet values from the ASN structures.
16  *
17  */
18
19 /* A helper structure to extract all the attribute stuff
20    from one Z_AttributesList. The pointers will all be to
21    the Z-structures, or to constants, so there is no need to
22    worry about freeing them */
23 struct attrvalues {
24     int  errcode;   /* set in case of errors */
25     char *errstring; /* opt */
26     const char *useattr; /* @attr 1, from a string attr */
27                    /* or number converted to a string */
28                    /* defaults to 'any' */
29     char useattrbuff[30]; /* for converting numbers to strings */
30     char *relation; /* @attr 2, defaults to '=' */
31     int limit; /* for facet attributes */
32 };
33
34 YAZ_EXPORT
35 void facet_struct_init(struct attrvalues *attr_values);
36
37 /* Use attribute, @attr1, can be numeric or string */
38 YAZ_EXPORT
39 void useattr ( Z_AttributeElement *ae, struct attrvalues *av );
40
41 YAZ_EXPORT
42 void relationattr ( Z_AttributeElement *ae, struct attrvalues *av );
43
44 YAZ_EXPORT
45 void limitattr ( Z_AttributeElement *ae, struct attrvalues *av );
46
47 YAZ_EXPORT
48 void limitattr ( Z_AttributeElement *ae, struct attrvalues *av );
49
50 YAZ_EXPORT
51 void facetattrs( Z_AttributeList *attributes, struct attrvalues *av );
52
53 YAZ_EXPORT
54 Z_FacetList *extract_facet_request(ODR odr, Z_OtherInformation *search_input);
55
56 YAZ_EXPORT
57 Z_Term *term_create(ODR odr, const char *cstr);
58
59 YAZ_EXPORT
60 Z_FacetTerm* facet_term_create(ODR odr, Z_Term *term, int freq);
61
62 YAZ_EXPORT
63 Z_FacetField* facet_field_create(ODR odr, Z_AttributeList *attributes, int num_terms);
64
65 YAZ_EXPORT
66 void facet_field_term_set(ODR odr, Z_FacetField *field, Z_FacetTerm *facetTerm, int index);
67
68 YAZ_EXPORT
69 Z_FacetList* facet_list_create(ODR odr, int num_facets);
70
71 YAZ_EXPORT
72 void facet_list_field_set(ODR odr, Z_FacetList *list, Z_FacetField *field, int index);
73
74 #endif