Only warn about unexpected elements once per session.
authorAdam Dickmeiss <adam@indexdata.dk>
Wed, 15 Oct 2008 10:05:39 +0000 (12:05 +0200)
committerAdam Dickmeiss <adam@indexdata.dk>
Wed, 15 Oct 2008 10:19:03 +0000 (12:19 +0200)
src/logic.c
src/pazpar2.h

index 4ac92f0..167c2ae 100644 (file)
@@ -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);
index 728bc3d..4330881 100644 (file)
@@ -140,6 +140,7 @@ struct session {
     int total_hits;
     int total_records;
     int total_merged;
+    int number_of_warnings_unknown_elements;
 };
 
 struct statistics {