From 98748934f357929917e4884ea656b1a003d4c775 Mon Sep 17 00:00:00 2001 From: Adam Dickmeiss Date: Wed, 15 Oct 2008 12:05:39 +0200 Subject: [PATCH] Only warn about unexpected elements 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 4ac92f0..167c2ae 100644 --- a/src/logic.c +++ b/src/logic.c @@ -707,6 +707,7 @@ struct session *new_session(NMEM nmem) 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; @@ -1214,9 +1215,13 @@ struct record *ingest_record(struct client *cl, const char *rec, 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); diff --git a/src/pazpar2.h b/src/pazpar2.h index 728bc3d..4330881 100644 --- a/src/pazpar2.h +++ b/src/pazpar2.h @@ -140,6 +140,7 @@ struct session { int total_hits; int total_records; int total_merged; + int number_of_warnings_unknown_elements; }; struct statistics { -- 1.7.10.4