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;
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);
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);
connection_continue(co);
return 1;
}
+ else
+ {
+ yaz_log(YLOG_LOG, "cl=%s. OK no more in total set", client_get_id(cl));
+ }
return 0;
}
struct record_cluster **recs = 0;
struct reclist_sortparms *spp;
struct client_list *l;
- int num0 = *num;
int i;
#if USE_TIMING
yaz_timing_t t = yaz_timing_create();
reclist_enter(se->reclist);
*total = reclist_get_num_records(se->reclist);
+ for (l = se->clients_active; l; l = l->next)
+ client_update_show_stat(l->client, 0);
+
for (i = 0; i < start; i++)
- if (!reclist_read_record(se->reclist))
+ {
+ struct record_cluster *r = reclist_read_record(se->reclist);
+ if (!r)
{
*num = 0;
break;
}
-
+ else
+ {
+ struct record *rec = r->records;
+ for (;rec; rec = rec->next)
+ client_update_show_stat(rec->client, 1);
+ }
+ }
if (*num > 0)
recs =
nmem_malloc(se->nmem, *num * sizeof(struct record_cluster *));
*num = i;
break;
}
- recs[i] = r;
+ else
+ {
+ struct record *rec = r->records;
+ for (;rec; rec = rec->next)
+ client_update_show_stat(rec->client, 1);
+ recs[i] = r;
+ }
}
reclist_leave(se->reclist);
#if USE_TIMING
yaz_timing_get_sys(t));
yaz_timing_destroy(&t);
#endif
- if (*num < num0)
+
+ if (!session_fetch_more(se))
+ session_log(se, YLOG_LOG, "can not fetch more");
+ else
{
- session_log(se, YLOG_LOG,
- "Subset %d < %d retrieved for show", *num, num0);
- if (!session_fetch_more(se))
- session_log(se, YLOG_LOG, "can not fetch more");
+ show_range_stop(se, recs);
+ session_log(se, YLOG_LOG, "fetching more in progress");
+ if (session_set_watch(se, SESSION_WATCH_SHOW,
+ show_records_ready, chan, chan))
+ {
+ session_log(se, YLOG_WARN, "Ignoring show block");
+ session_enter(se, "show_range_start");
+ }
else
{
- show_range_stop(se, recs);
- session_log(se, YLOG_LOG, "fetching more in progress");
- if (session_set_watch(se, SESSION_WATCH_SHOW,
- show_records_ready, chan, chan))
- {
- session_log(se, YLOG_WARN, "Ignoring show block");
- session_enter(se, "show_range_start");
- }
- else
- {
- session_log(se, YLOG_LOG, "session watch OK");
- return 0;
- }
+ session_log(se, YLOG_LOG, "session watch OK");
+ return 0;
}
}
return recs;