+ if (reclist_get_num_records(se->reclist) > 0)
+ {
+ client_unlock(cl);
+ session_alert_watch(se, SESSION_WATCH_SHOW);
+ session_alert_watch(se, SESSION_WATCH_BYTARGET);
+ session_alert_watch(se, SESSION_WATCH_TERMLIST);
+ session_alert_watch(se, SESSION_WATCH_RECORD);
+ client_lock(cl);
+ }
+ }
+}
+
+static void client_record_ingest(struct client *cl)
+{
+ const char *msg, *addinfo;
+ ZOOM_record rec = 0;
+ ZOOM_resultset resultset = cl->resultset;
+ int offset = cl->record_offset;
+ if ((rec = ZOOM_resultset_record_immediate(resultset, offset)))
+ {
+ cl->record_offset++;
+ if (cl->session == 0) {
+ /* no operation */
+ }
+ else if (ZOOM_record_error(rec, &msg, &addinfo, 0))
+ {
+ yaz_log(YLOG_WARN, "Record error %s (%s): %s (rec #%d)",
+ msg, addinfo, client_get_id(cl), cl->record_offset);
+ }
+ else
+ {
+ struct session_database *sdb = client_get_database(cl);
+ NMEM nmem = nmem_create();
+ const char *xmlrec;
+ char type[80];
+
+ const char *s = session_setting_oneval(sdb, PZ_NATIVESYNTAX);
+ if (nativesyntax_to_type(s, type, rec))
+ yaz_log(YLOG_WARN, "Failed to determine record type");
+ xmlrec = ZOOM_record_get(rec, type, NULL);
+ if (!xmlrec)
+ yaz_log(YLOG_WARN, "ZOOM_record_get failed from %s",
+ client_get_id(cl));
+ else
+ {
+ /* OK = 0, -1 = failure, -2 = Filtered */
+ int rc = ingest_record(cl, xmlrec, cl->record_offset, nmem);
+ if (rc == -1)
+ yaz_log(YLOG_WARN, "Failed to ingest from %s", client_get_id(cl));
+ if (rc == -2)
+ cl->filtered += 1;
+ }
+ nmem_destroy(nmem);
+ }
+ }
+ else
+ {
+ yaz_log(YLOG_WARN, "Expected record, but got NULL, offset=%d", offset);