#if HAVE_UNISTD_H
#include <unistd.h>
#endif
-#if HAVE_SYS_SOCKET_H
-#include <sys/socket.h>
-#endif
-#if HAVE_NETDB_H
-#include <netdb.h>
-#endif
#include <signal.h>
#include <ctype.h>
#include <assert.h>
#include <yaz/timing.h>
#endif
-#if HAVE_NETINET_IN_H
-#include <netinet/in.h>
-#endif
#include "pazpar2.h"
#include "eventl.h"
15 // Connect timeout
};
+static void log_xml_doc(xmlDoc *doc)
+{
+ FILE *lf = yaz_log_file();
+ xmlChar *result = 0;
+ int len = 0;
+#if LIBXML_VERSION >= 20600
+ xmlDocDumpFormatMemory(doc, &result, &len, 1);
+#else
+ xmlDocDumpMemory(doc, &result, &len);
+#endif
+ if (lf && len)
+ {
+ fwrite(result, 1, len, lf);
+ fprintf(lf, "\n");
+ }
+ xmlFree(result);
+}
+
// Recursively traverse query structure to extract terms.
void pull_terms(NMEM nmem, struct ccl_rpn_node *n, char **termlist, int *num)
{
if (global_parameters.dump_records)
{
- FILE *lf = yaz_log_file();
- if (lf)
- {
- yaz_log(YLOG_LOG, "Un-normalized record from %s", db->url);
-#if LIBXML_VERSION >= 20600
- xmlDocFormatDump(lf, rdoc, 1);
-#else
- xmlDocDump(lf, rdoc);
-#endif
- fprintf(lf, "\n");
- }
+ yaz_log(YLOG_LOG, "Un-normalized record from %s", db->url);
+ log_xml_doc(rdoc);
}
return rdoc;
if (global_parameters.dump_records)
{
- FILE *lf = yaz_log_file();
-
- if (lf)
- {
- yaz_log(YLOG_LOG, "Normalized record from %s",
- sdb->database->url);
-#if LIBXML_VERSION >= 20600
- xmlDocFormatDump(lf, rdoc, 1);
-#else
- xmlDocDump(lf, rdoc);
-#endif
- fprintf(lf, "\n");
- }
+ yaz_log(YLOG_LOG, "Normalized record from %s",
+ sdb->database->url);
+ log_xml_doc(rdoc);
}
}
return rdoc;
se->reclist = 0;
se->num_termlists = 0;
criteria = parse_filter(se->nmem, filter);
- se->requestid++;
live_channels = select_targets(se, criteria);
if (live_channels)
{
session->relevance = 0;
session->total_hits = 0;
session->total_records = 0;
+ session->number_of_warnings_unknown_elements = 0;
+ session->number_of_warnings_unknown_metadata = 0;
session->num_termlists = 0;
session->reclist = 0;
- session->requestid = -1;
session->clients = 0;
session->expected_maxrecs = 0;
session->session_nmem = nmem;
return 0;
}
relevance_newrec(se->relevance, cluster);
-
+
// now parsing XML record and adding data to cluster or record metadata
for (n = root->children; n; n = n->next)
= conf_service_metadata_field_id(service, (const char *) type);
if (md_field_id < 0)
{
- yaz_log(YLOG_WARN,
- "Ignoring unknown metadata element: %s", type);
+ if (se->number_of_warnings_unknown_metadata == 0)
+ {
+ yaz_log(YLOG_WARN,
+ "Ignoring unknown metadata element: %s", type);
+ }
+ se->number_of_warnings_unknown_metadata++;
continue;
}
xmlFree(value);
type = value = 0;
}
- else
- yaz_log(YLOG_WARN,
- "Unexpected element %s in internal record", n->name);
+ else
+ {
+ if (se->number_of_warnings_unknown_elements == 0)
+ yaz_log(YLOG_WARN,
+ "Unexpected element in internal record: %s", n->name);
+ se->number_of_warnings_unknown_elements++;
+ }
}
if (type)
xmlFree(type);