}
else
{
- yaz_log(YLOG_DEBUG, "client_search_response: hits " ODR_INT_PRINTF, cl->hits);
client_report_facets(cl, resultset);
cl->record_offset = cl->startrecs;
cl->hits = ZOOM_resultset_size(resultset);
+ yaz_log(YLOG_DEBUG, "client_search_response: hits " ODR_INT_PRINTF, cl->hits);
if (cl->suggestions)
client_suggestions_destroy(cl);
cl->suggestions = client_suggestions_create(ZOOM_resultset_option_get(resultset, "suggestions"));
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);
+ msg, addinfo, client_get_id(cl), cl->record_offset);
}
else
{
int present_chunk = 20; // Default chunk size
if (opt_present_chunk && strcmp(opt_present_chunk,"")) {
present_chunk = atoi(opt_present_chunk);
+ yaz_log(YLOG_DEBUG, "Present chunk set to %d", present_chunk);
}
assert(link);
/* A present_chunk less than 1 will disable chunking. */
if (present_chunk > 0 && cl->maxrecs > present_chunk) {
sprintf(present_chunk_str, "%d", present_chunk);
- ZOOM_connection_option_set(link, "presentChunk", opt_present_chunk);
+ ZOOM_connection_option_set(link, "presentChunk", present_chunk_str);
+ yaz_log(YLOG_DEBUG, "Present chunk set to %s", present_chunk_str);
}
- else
+ else {
ZOOM_connection_option_set(link, "presentChunk", maxrecs_str);
-
+ yaz_log(YLOG_DEBUG, "Present chunk set to %s (maxrecs)", maxrecs_str);
+ }
sprintf(startrecs_str, "%d", cl->startrecs);
ZOOM_connection_option_set(link, "start", startrecs_str);
Odr_int client_get_approximation(struct client *cl)
{
- int records = cl->record_offset + cl->filtered;
- if (records > 0)
- return cl->hits * cl->record_offset / records;
+ if (cl->record_offset > 0) {
+ Odr_int approx = ((10 * cl->hits * (cl->record_offset - cl->filtered)) / cl->record_offset + 5) /10;
+ yaz_log(YLOG_LOG, "%s: Approx: %lld * %d / %d = %lld ", client_get_id(cl), cl->hits, cl->record_offset - cl->filtered, cl->record_offset, approx);
+ return approx;
+ }
return cl->hits;
}