+}
+
+Z_FacetTerm *facet_term_create_cstr(ODR odr, const char *cstr, Odr_int freq)
+{
+ Z_FacetTerm *facet_term = odr_malloc(odr, sizeof(*facet_term));
+ Z_Term *term = z_Term_create(odr, Z_Term_general, cstr, strlen(cstr));
+ facet_term->term = term;
+ facet_term->count = odr_intdup(odr, freq);
+ return facet_term;
+}
+
+Z_FacetField* facet_field_create(ODR odr, Z_AttributeList *attributes,
+ int num_terms)
+{
+ Z_FacetField *facet_field = odr_malloc(odr, sizeof(*facet_field));
+ facet_field->attributes = attributes;
+ facet_field->num_terms = num_terms;
+ facet_field->terms = odr_malloc(odr, num_terms * sizeof(*facet_field->terms));
+ return facet_field;
+}
+
+void facet_field_term_set(ODR odr, Z_FacetField *field,
+ Z_FacetTerm *facet_term, int index)
+{
+ assert(0 <= index && index < field->num_terms);
+ field->terms[index] = facet_term;
+}
+
+Z_FacetList* facet_list_create(ODR odr, int num_facets)
+{
+ Z_FacetList *facet_list = odr_malloc(odr, sizeof(*facet_list));
+ facet_list->num = num_facets;
+ facet_list->elements =
+ odr_malloc(odr, facet_list->num * sizeof(*facet_list->elements));
+ return facet_list;
+}
+
+void facet_list_field_set(ODR odr, Z_FacetList *list, Z_FacetField *field,
+ int index)
+{
+ assert(0 <= index && index < list->num);
+ list->elements[index] = field;
+}
+
+/*
+ * Local variables:
+ * c-basic-offset: 4
+ * c-file-style: "Stroustrup"
+ * indent-tabs-mode: nil
+ * End:
+ * vim: shiftwidth=4 tabstop=8 expandtab
+ */