CQL: accept relations "within", "encloses"
[yaz-moved-to-github.git] / src / facet.c
index 588e802..a9d1ef9 100644 (file)
@@ -1,9 +1,9 @@
 /* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2011 Index Data
+ * Copyright (C) 1995-2013 Index Data
  * See the file LICENSE for details.
  */
 
-/** 
+/**
  * \file facet.c
  * \brief Facet utilities
  */
@@ -17,6 +17,7 @@
 #include <yaz/oid_db.h>
 #include <yaz/oid_std.h>
 #include <yaz/otherinfo.h>
+#include <yaz/pquery.h>
 #include <assert.h>
 
 void yaz_oi_set_facetlist(
@@ -199,6 +200,7 @@ void yaz_facet_attr_get_z_attributes(const Z_AttributeList *attributes,
     return;
 } /* facetattrs */
 
+#if 0
 Z_Term *term_create(ODR odr, const char *cstr)
 {
     Z_Term *term = odr_malloc(odr, sizeof(*term));
@@ -215,6 +217,16 @@ Z_FacetTerm* facet_term_create(ODR odr, Z_Term *term, int freq)
     *facet_term->count = freq;
     return facet_term;
 }
+#endif
+
+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)