From d2cbbfa12b18301e94bca427cf8bf1b2ea6151b3 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 92a0ecf..4239171 100644 --- a/src/logic.c +++ b/src/logic.c @@ -847,6 +847,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; @@ -1356,9 +1357,13 @@ struct record *ingest_record(struct client *cl, Z_External *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 72310aa..82498eb 100644 --- a/src/pazpar2.h +++ b/src/pazpar2.h @@ -138,6 +138,7 @@ struct session { int total_hits; int total_records; int total_merged; + int number_of_warnings_unknown_elements; }; struct statistics { -- 1.7.10.4