/* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2011 Index Data
+ * Copyright (C) 1995-2012 Index Data
* See the file LICENSE for details.
*/
/**
#if YAZ_HAVE_XML2
#include <libxml/parser.h>
#include <libxml/tree.h>
-#endif
static void extract_text_node(xmlNodePtr node, WRBUF wrbuf) {
xmlNodePtr child;
record->recordData_buf = odr_malloc(o, buf->use + 1);
memcpy(record->recordData_buf, buf->content, buf->use);
record->recordData_buf[buf->use] = '\0';
- // TODO Solve the real problem in zoom-sru, that doesnt work with 0-based indexes.
- // Work-around: Making the recordPosition 1-based.
record->recordPosition = odr_intdup(o, start + offset + 1);
xmlBufferFree(buf);
return 0;
}
-static void yaz_solr_decode_suggestion_values(xmlNodePtr ptr, WRBUF wrbuf)
+static void yaz_solr_decode_suggestion_values(xmlNodePtr listPptr, WRBUF wrbuf)
{
xmlNodePtr node;
- for (node = ptr; node; node= node->next) {
- if (!strcmp((char*)ptr->name, "lst")) {
+ for (node = listPptr; node; node= node->next) {
+ if (!strcmp((char*) node->name, "lst")) {
xmlNodePtr child;
- for (child = ptr->children; child; child= child->next) {
+ for (child = node->children; child; child= child->next) {
if (match_xml_node_attribute(child, "str", "name", "word")) {
wrbuf_puts(wrbuf, "<suggestion>");
extract_text_node(child, wrbuf);
xmlNodePtr node;
for (node = lstPtr; node; node= node->next)
{
- if (strcmp((const char*) node->name, "lst")) {
+ if (!strcmp((const char*) node->name, "lst")) {
const char *misspelled = yaz_element_attribute_value_get(node, "lst", "name");
if (misspelled) {
- wrbuf_printf(wrbuf, "<misspelled term=\"%s\">", misspelled);
+ wrbuf_printf(wrbuf, "<misspelled term=\"%s\">\n", misspelled);
yaz_solr_decode_suggestion_lst(node->children, wrbuf);
wrbuf_puts(wrbuf, "</misspelled>\n");
}
sr->suggestions = odr_strdup(o, wrbuf_cstr(wrbuf));
return 0;
}
+#endif
int yaz_solr_decode_response(ODR o, Z_HTTP_Response *hres, Z_SRW_PDU **pdup)
{