char *addinfo; // diagnostic info for most resent error
Odr_int hits;
int record_offset;
+ int show_stat_no;
int filtered; // When using local:, this will count the number of filtered records.
int maxrecs;
int startrecs;
}
}
-void client_record_response(struct client *cl)
+void client_record_response(struct client *cl, int *got_records)
{
struct connection *co = cl->connection;
ZOOM_connection link = connection_get_link(co);
else
{
client_record_ingest(cl);
+ *got_records = 1;
}
}
}
return strategy_plus_sort;
}
+void client_update_show_stat(struct client *cl, int cmd)
+{
+ if (cmd == 0)
+ cl->show_stat_no = 0;
+ else if (cmd == 1)
+ cl->show_stat_no++;
+}
+
int client_fetch_more(struct client *cl)
{
struct session_database *sdb = client_get_database(cl);
const char *str;
- int extra = cl->hits - cl->record_offset;
+ int extend_recs = 0;
+ int number;
+
+ yaz_log(YLOG_LOG, "cl=%s show_stat_no=%d got=%d",
+ client_get_id(cl), cl->show_stat_no, cl->record_offset);
+ if (cl->show_stat_no < cl->record_offset)
+ return 0;
+ yaz_log(YLOG_LOG, "cl=%s Trying to get more", client_get_id(cl));
+
+ str = session_setting_oneval(sdb, PZ_EXTENDRECS);
+ if (str && *str)
+ extend_recs = atoi(str);
- if (extra > 0)
+ if (extend_recs > cl->hits)
+ extend_recs = cl->hits;
+
+ number = extend_recs - cl->record_offset;
+ if (number > 0)
{
ZOOM_resultset set = cl->resultset;
struct connection *co = client_get_connection(cl);
- int max_extra = 10;
-
- if (extra > max_extra)
- extra = max_extra;
str = session_setting_oneval(sdb, PZ_REQUESTSYNTAX);
ZOOM_resultset_option_set(set, "preferredRecordSyntax", str);
if (str && *str)
ZOOM_resultset_option_set(set, "elementSetName", str);
- ZOOM_resultset_records(set, 0, cl->record_offset, extra);
+ ZOOM_resultset_records(set, 0, cl->record_offset, number);
client_set_state(cl, Client_Working);
connection_continue(co);
return 1;
}
+ else
+ {
+ yaz_log(YLOG_LOG, "cl=%s. OK no more in total set", client_get_id(cl));
+ }
return 0;
}