#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->num_termlists = 0;
session->reclist = 0;
- session->requestid = -1;
session->clients = 0;
session->expected_maxrecs = 0;
session->session_nmem = nmem;
wheretoput = &record->metadata[md_field_id];
while (*wheretoput)
wheretoput = &(*wheretoput)->next;
- rec_md->next = 0;
*wheretoput = rec_md;
// merged metadata
// and polulate with data:
// assign cluster or record based on merge action
+ if (ser_md->merge == Metadata_merge_no)
+ {
+ while (*wheretoput)
+ wheretoput = &(*wheretoput)->next;
+ *wheretoput = rec_md;
+ }
if (ser_md->merge == Metadata_merge_unique)
{
struct record_metadata *mnode;
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);