return strategy_plus_sort;
}
+int client_fetch_more(struct client *cl)
+{
+ struct session_database *sdb = client_get_database(cl);
+ const char *str;
+ int extend_recs = 0;
+ int number;
+
+ str = session_setting_oneval(sdb, PZ_EXTENDRECS);
+ if (str && *str)
+ extend_recs = atoi(str);
+
+ 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);
+
+ str = session_setting_oneval(sdb, PZ_REQUESTSYNTAX);
+ ZOOM_resultset_option_set(set, "preferredRecordSyntax", str);
+ str = session_setting_oneval(sdb, PZ_ELEMENTS);
+ if (str && *str)
+ ZOOM_resultset_option_set(set, "elementSetName", str);
+
+ ZOOM_resultset_records(set, 0, cl->record_offset, number);
+ client_set_state(cl, Client_Working);
+ connection_continue(co);
+ return 1;
+ }
+ return 0;
+}
+
int client_parse_init(struct client *cl, int same_search)
{
cl->same_search = same_search;
iochan_man_t iochan,
const struct timeval *abstime);
int client_start_search(struct client *cl);
+int client_fetch_more(struct client *cl);
int client_parse_init(struct client *cl, int same_search);
int client_parse_range(struct client *cl, const char *startrecs, const char *maxrecs);
int client_parse_sort(struct client *cl, struct reclist_sortparms *sp);
static YAZ_MUTEX g_http_session_mutex = 0;
static int g_http_sessions = 0;
+static void show_records_ready(void *data);
+
int get_version(struct http_request *rq) {
const char *version = http_argbyname(rq, "version");
int version_no = 0;
}
- rl = show_range_start(s->psession, sp, startn, &numn, &total, &total_hits, &approx_hits);
+ i = numn;
+ rl = show_range_start(s->psession, sp, startn, &numn, &total,
+ &total_hits, &approx_hits);
+ if (i > numn)
+ {
+ show_range_stop(s->psession, rl);
+ session_log(s->psession, YLOG_LOG,
+ "Subset %d < %d retrieved for show", numn, i);
+ if (!session_fetch_more(s->psession))
+ session_log(s->psession, YLOG_LOG, "can not fetch more");
+ else
+ {
+ session_log(s->psession, YLOG_LOG, "fetching more in progress");
+ if (session_set_watch(s->psession, SESSION_WATCH_SHOW,
+ show_records_ready, c, c))
+ session_log(s->psession, YLOG_WARN, "Ignoring show block");
+ else
+ {
+ session_log(s->psession, YLOG_LOG, "session watch OK");
+ return;
+ }
+ }
+ rl = show_range_start(s->psession, sp, startn, &numn, &total,
+ &total_hits, &approx_hits);
+ }
response_open(c, "show");
wrbuf_printf(c->wrbuf, "\n<activeclients>%d</activeclients>\n", active);
}
+int session_fetch_more(struct session *se)
+{
+ struct client_list *l;
+ int ret = 0;
+
+ for (l = se->clients_active; l; l = l->next)
+ {
+ struct client *cl = l->client;
+ if (client_get_state(cl) == Client_Idle)
+ {
+ if (client_fetch_more(cl))
+ {
+ session_log(se, YLOG_LOG, "%s: more to fetch",
+ client_get_id(cl));
+ ret = 1;
+ }
+ else
+ {
+ session_log(se, YLOG_LOG, "%s: no more to fetch",
+ client_get_id(cl));
+ }
+ }
+ else
+ {
+ session_log(se, YLOG_LOG, "%s: no fetch due to state=%s",
+ client_get_id(cl), client_get_state_str(cl));
+ }
+
+ }
+ return ret;
+}
+
struct record_cluster **show_range_start(struct session *se,
struct reclist_sortparms *sp,
int start, int *num, int *total,
struct record_cluster **show_range_start(struct session *s,
struct reclist_sortparms *sp,
int start,
- int *num, int *total, Odr_int *sumhits, Odr_int *approximation);
+ int *num, int *total,
+ Odr_int *sumhits,
+ Odr_int *approximation);
+
+int session_fetch_more(struct session *s);
void show_range_stop(struct session *s, struct record_cluster **recs);
struct record_cluster *show_single_start(struct session *s, const char *id,
"pz:sortmap:",
"pz:present_chunk",
"pz:block_timeout",
+ "pz:extendrecs",
0
};
#define PZ_SORTMAP 31
#define PZ_PRESENT_CHUNK 32
#define PZ_BLOCK_TIMEOUT 33
-#define PZ_MAX_EOF 34
+#define PZ_EXTENDRECS 34
+#define PZ_MAX_EOF 35
struct setting
{
<set name="pz:apdulog" value="1"/>
<set name="pz:maxrecs" value="3" />
+ <set name="pz:extendrecs" value="6" />
</settings>
<metadata name="url" merge="unique"/>
<?xml version="1.0" encoding="UTF-8"?>
<show><status>OK</status>
<activeclients>0</activeclients>
-<merged>3</merged>
+<merged>6</merged>
<total>17</total>
<start>0</start>
-<num>3</num>
+<num>6</num>
<hit>
<md-title>UTAH GEOCHROMOMETRY</md-title>
<location id="z3950.indexdata.com/gils"
<md-title>UTAH GEOCHROMOMETRY</md-title>
</location>
<count>1</count>
- <relevance>86304</relevance>
+ <relevance>100941</relevance>
<relevance_info>
field=title content=UTAH GEOCHROMOMETRY;
utah: w[1] += w(6) / (1+log2(1+lead_decay(0.000000) * length(0)));
utah: tf[1] += w[1](6) / length(2) (3.000000);
relevance = 0;
-idf[1] = log(((1 + total(3))/termoccur(3));
-utah: relevance += 100000 * tf[1](3.000000) * idf[1](0.287682) (86304);
-score = relevance(86304);
+idf[1] = log(((1 + total(6))/termoccur(5));
+utah: relevance += 100000 * tf[1](3.000000) * idf[1](0.336472) (100941);
+score = relevance(100941);
</relevance_info>
<recid>content: title utah geochromometry author medium book</recid>
</hit>
<hit>
+ <md-title>UTAH CRIB FILE</md-title>
+ <location id="z3950.indexdata.com/gils"
+ name="Index Data GILS test server" checksum="2596737976">
+ <md-title>UTAH CRIB FILE</md-title>
+ </location>
+ <count>1</count>
+ <relevance>67294</relevance>
+ <relevance_info>
+field=title content=UTAH CRIB FILE;
+utah: w[1] += w(6) / (1+log2(1+lead_decay(0.000000) * length(0)));
+utah: tf[1] += w[1](6) / length(3) (2.000000);
+relevance = 0;
+idf[1] = log(((1 + total(6))/termoccur(5));
+utah: relevance += 100000 * tf[1](2.000000) * idf[1](0.336472) (67294);
+score = relevance(67294);
+ </relevance_info>
+ <recid>content: title utah crib file author medium book</recid>
+</hit>
+<hit>
<md-title>UTAH EARTHQUAKE EPICENTERS</md-title>
<location id="z3950.indexdata.com/gils"
name="Index Data GILS test server" checksum="1725776531">
<md-title>UTAH EARTHQUAKE EPICENTERS</md-title>
</location>
<count>1</count>
- <relevance>57536</relevance>
+ <relevance>67294</relevance>
<relevance_info>
field=title content=UTAH EARTHQUAKE EPICENTERS;
utah: w[1] += w(6) / (1+log2(1+lead_decay(0.000000) * length(0)));
utah: tf[1] += w[1](6) / length(3) (2.000000);
relevance = 0;
-idf[1] = log(((1 + total(3))/termoccur(3));
-utah: relevance += 100000 * tf[1](2.000000) * idf[1](0.287682) (57536);
-score = relevance(57536);
+idf[1] = log(((1 + total(6))/termoccur(5));
+utah: relevance += 100000 * tf[1](2.000000) * idf[1](0.336472) (67294);
+score = relevance(67294);
</relevance_info>
<recid>content: title utah earthquake epicenters author medium book</recid>
</hit>
<hit>
+ <md-title>UTAH OIL FIELD FILE</md-title>
+ <location id="z3950.indexdata.com/gils"
+ name="Index Data GILS test server" checksum="2248353398">
+ <md-title>UTAH OIL FIELD FILE</md-title>
+ </location>
+ <count>1</count>
+ <relevance>50470</relevance>
+ <relevance_info>
+field=title content=UTAH OIL FIELD FILE;
+utah: w[1] += w(6) / (1+log2(1+lead_decay(0.000000) * length(0)));
+utah: tf[1] += w[1](6) / length(4) (1.500000);
+relevance = 0;
+idf[1] = log(((1 + total(6))/termoccur(5));
+utah: relevance += 100000 * tf[1](1.500000) * idf[1](0.336472) (50470);
+score = relevance(50470);
+ </relevance_info>
+ <recid>content: title utah oil field file author medium book</recid>
+</hit>
+<hit>
<md-title>UTAH GEOLOGICAL AND MINERAL SURVEY PUBLICATIONS</md-title>
<location id="z3950.indexdata.com/gils"
name="Index Data GILS test server" checksum="1899968820">
<md-title>UTAH GEOLOGICAL AND MINERAL SURVEY PUBLICATIONS</md-title>
</location>
<count>1</count>
- <relevance>28768</relevance>
+ <relevance>33647</relevance>
<relevance_info>
field=title content=UTAH GEOLOGICAL AND MINERAL SURVEY PUBLICATIONS;
utah: w[1] += w(6) / (1+log2(1+lead_decay(0.000000) * length(0)));
utah: tf[1] += w[1](6) / length(6) (1.000000);
relevance = 0;
-idf[1] = log(((1 + total(3))/termoccur(3));
-utah: relevance += 100000 * tf[1](1.000000) * idf[1](0.287682) (28768);
-score = relevance(28768);
+idf[1] = log(((1 + total(6))/termoccur(5));
+utah: relevance += 100000 * tf[1](1.000000) * idf[1](0.336472) (33647);
+score = relevance(33647);
</relevance_info>
<recid>content: title utah geological and mineral survey publications author medium book</recid>
</hit>
+<hit>
+ <md-title>APPLIED GEOLOGY FILE</md-title>
+ <location id="z3950.indexdata.com/gils"
+ name="Index Data GILS test server" checksum="2422545687">
+ <md-title>APPLIED GEOLOGY FILE</md-title>
+ </location>
+ <count>1</count>
+ <relevance>0</relevance>
+ <relevance_info>
+relevance = 0;
+idf[1] = log(((1 + total(6))/termoccur(5));
+utah: relevance += 100000 * tf[1](0.000000) * idf[1](0.336472) (0);
+score = relevance(0);
+ </relevance_info>
+ <recid>content: title applied geology file author medium book</recid>
+</hit>
</show>
\ No newline at end of file