int record_offset;
int show_stat_no;
int filtered; /* number of records ignored for local filtering */
+ int ingest_failures; /* number of records where XSLT/other failed */
+ int record_failures; /* number of records where ZOOM reported error */
int maxrecs;
int startrecs;
int diagnostic;
if (ZOOM_connection_error(link, &error, &addinfo))
{
cl->hits = 0;
- client_set_state(cl, Client_Error);
session_log(se, YLOG_WARN, "%s: Error %s (%s)",
client_get_id(cl), error, addinfo);
+ client_set_state(cl, Client_Error);
}
else
{
NMEM nmem = nmem_create();
int rc = ingest_xml_record(cl, xdoc, offset, nmem, 1);
if (rc == -1)
+ {
session_log(se, YLOG_WARN,
- "Failed to ingest xdoc from %s #%d",
+ "%s: #%d: failed to ingest xdoc",
client_get_id(cl), offset);
+ cl->ingest_failures++;
+ }
else if (rc == -2)
cl->filtered++;
nmem_destroy(nmem);
{
session_log(se, YLOG_WARN, "Record error %s (%s): %s #%d",
msg, addinfo, client_get_id(cl), offset);
+ cl->record_failures++;
}
else
{
if (!xmlrec)
{
const char *rec_syn = ZOOM_record_get(rec, "syntax", NULL);
- session_log(se, YLOG_WARN, "ZOOM_record_get failed from %s #%d",
+ session_log(se, YLOG_WARN, "%s: #%d: ZOOM_record_get failed",
client_get_id(cl), offset);
session_log(se, YLOG_LOG, "pz:nativesyntax=%s . "
"ZOOM record type=%s . Actual record syntax=%s",
s ? s : "null", type,
rec_syn ? rec_syn : "null");
+ cl->ingest_failures++;
}
else
{
{
const char *rec_syn = ZOOM_record_get(rec, "syntax", NULL);
session_log(se, YLOG_WARN,
- "Failed to ingest record from %s #%d",
+ "%s: #%d: failed to ingest record",
client_get_id(cl), offset);
session_log(se, YLOG_LOG, "pz:nativesyntax=%s . "
"ZOOM record type=%s . Actual record syntax=%s",
s ? s : "null", type,
rec_syn ? rec_syn : "null");
+ cl->ingest_failures++;
}
else if (rc == -2)
cl->filtered++;
if (ZOOM_connection_error(link, &error, &addinfo))
{
+ struct session *se = client_get_session(cl);
+ session_log(se, YLOG_WARN, "%s: Error %s (%s)",
+ client_get_id(cl), error, addinfo);
client_set_state(cl, Client_Error);
- yaz_log(YLOG_WARN, "Search error %s (%s): %s",
- error, addinfo, client_get_id(cl));
}
else
{
{
int i = cl->startrecs;
int to = cl->record_offset;
- cl->filtered = 0;
+ cl->record_failures = cl->ingest_failures = cl->filtered = 0;
cl->record_offset = i;
for (; i < to; i++)
session_log(se, YLOG_LOG, "%s: new search", client_get_id(cl));
cl->diagnostic = 0;
- cl->filtered = 0;
+ cl->record_failures = cl->ingest_failures = cl->filtered = 0;
client_destroy_xdoc(cl);
client_init_xdoc(cl);
return cl->hits;
}
-int client_get_num_records(struct client *cl)
+int client_get_num_records(struct client *cl, int *filtered, int *ingest,
+ int *failed)
{
+ if (filtered)
+ *filtered = cl->filtered;
+ if (ingest)
+ *ingest = cl->ingest_failures;
+ if (failed)
+ *failed = cl->record_failures;
return cl->record_offset;
}
-int client_get_num_records_filtered(struct client *cl)
-{
- return cl->filtered;
-}
-
void client_set_diagnostic(struct client *cl, int diagnostic,
const char *message, const char *addinfo)
{
WRBUF w = wrbuf_alloc();
const char *name = session_setting_oneval(client_get_database(cl),
PZ_NAME);
-
res[*count].id = client_get_id(cl);
res[*count].name = *name ? name : "Unknown";
res[*count].hits = client_get_hits(cl);
res[*count].approximation = client_get_approximation(cl);
- res[*count].records = client_get_num_records(cl);
- res[*count].filtered = client_get_num_records_filtered(cl);
+ res[*count].records = client_get_num_records(cl,
+ &res[*count].filtered,
+ 0, 0);
res[*count].diagnostic =
client_get_diagnostic(cl, &res[*count].message,
&res[*count].addinfo);
}
else
{
- session_log(se, YLOG_LOG, "%s: no more to fetch",
- client_get_id(cl));
+ int filtered;
+ int ingest_failures;
+ int record_failures;
+ int num = client_get_num_records(
+ cl, &filtered, &ingest_failures, &record_failures);
+
session_log(se, YLOG_LOG, "%s: hits=" ODR_INT_PRINTF
- " records=%d filtered=%d",
+ " fetched=%d filtered=%d",
client_get_id(cl),
client_get_hits(cl),
- client_get_num_records(cl),
- client_get_num_records_filtered(cl));
+ num, filtered);
+ if (ingest_failures || record_failures)
+ {
+ session_log(se, YLOG_WARN, "%s:"
+ " ingest failures=%d record failures=%d",
+ client_get_id(cl),
+ ingest_failures, record_failures);
+ }
}
}
else