From d3c33ee221a22387ff0c260ba953aeffdd7ea040 Mon Sep 17 00:00:00 2001 From: Dennis Schafroth Date: Thu, 26 Aug 2010 16:49:30 +0200 Subject: [PATCH] Implement SOLR xml int reader (for term + freq) --- src/solr.c | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/src/solr.c b/src/solr.c index d5afb4a..84af29d 100644 --- a/src/solr.c +++ b/src/solr.c @@ -14,6 +14,7 @@ #include #include #include +#include #include "sru-p.h" @@ -120,8 +121,20 @@ static Z_AttributeList *yaz_solr_use_atttribute_create(ODR o, const char *name) static const char *get_facet_term_count(xmlNodePtr node, int *freq) { - // TODO implement - return 0; + + const char *term = xml_node_attribute_value_get(node, "int", "name"); + xmlNodePtr child; + WRBUF wrbuf = wrbuf_alloc(); + if (!term) + return term; + + for (child = node->children; child ; child = child->next) { + if (child->type == XML_TEXT_NODE) + wrbuf_puts(wrbuf, (const char *) child->content); + } + *freq = atoi(wrbuf_cstr(wrbuf)); + wrbuf_destroy(wrbuf); + return term; } Z_FacetField *yaz_solr_decode_facet_field(ODR o, xmlNodePtr ptr, Z_SRW_searchRetrieveResponse *sr) -- 1.7.10.4