Odr_int client_get_approximation(struct client *cl)
{
- int records = cl->record_offset + cl->filtered;
- if (records > 0) {
- Odr_int approx = (cl->hits * cl->record_offset) / records;
- yaz_log(YLOG_LOG, "%s: Approx: %lld * %d / %d = %lld ", client_get_id(cl), cl->hits, cl->record_offset, records, approx);
+ if (cl->record_offset > 0) {
+ Odr_int approx = (cl->hits * (cl->record_offset - cl->filtered)) / cl->record_offset;
+ 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;