-static Z_FacetField* parse_facet(ODR odr, const char *facet, int length)
-{
- YAZ_PQF_Parser pqf_parser = yaz_pqf_create();
- char buffer[length+1];
- Odr_oid *attributeSetId;
- Z_FacetField *facet_field;
- Z_AttributeList *attribute_list;
- memcpy(buffer, facet, length);
- buffer[length] = '\0';
- attribute_list = yaz_pqf_scan_attribute_list(pqf_parser, odr, &attributeSetId, buffer);
-
- if (!attribute_list) {
- printf("Invalid facet definition: %s", facet);
- return 0;
- }
- facet_field = odr_malloc(odr, sizeof(*facet_field));
- facet_field->attributes = attribute_list;
- facet_field->num_terms = 0;
- facet_field->terms = 0;
- //debug_add_facet_term(odr, facet_field);
-
- return facet_field;
-}
-
-#define FACET_DElIMITER ','
-
-static int scan_facet_argument(const char *arg) {
- int index;
- int length = strlen(arg);
- int count = 1;
- for (index = 0; index < length; index++) {
- if (arg[index] == FACET_DElIMITER)
- count++;
- }
- return count;
-}
-