From 018e5efbcf436e0211bce6594a81c1501e29d1a9 Mon Sep 17 00:00:00 2001 From: Adam Dickmeiss Date: Thu, 23 Oct 2008 09:46:42 +0200 Subject: [PATCH] Only report 'unknown metadata element' once per session. --- src/logic.c | 11 ++++++++--- src/pazpar2.h | 1 + 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/logic.c b/src/logic.c index 2096f30..266aa0a 100644 --- a/src/logic.c +++ b/src/logic.c @@ -697,6 +697,7 @@ struct session *new_session(NMEM nmem) 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->clients = 0; @@ -1019,7 +1020,7 @@ struct record *ingest_record(struct client *cl, const char *rec, 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) @@ -1051,8 +1052,12 @@ struct record *ingest_record(struct client *cl, const char *rec, = 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; } diff --git a/src/pazpar2.h b/src/pazpar2.h index ded428d..8a09240 100644 --- a/src/pazpar2.h +++ b/src/pazpar2.h @@ -140,6 +140,7 @@ struct session { int total_records; int total_merged; int number_of_warnings_unknown_elements; + int number_of_warnings_unknown_metadata; }; struct statistics { -- 1.7.10.4