From: Dennis Schafroth Date: Fri, 13 Apr 2012 13:44:27 +0000 (+0200) Subject: Fix calc. of approximation X-Git-Tag: v1.6.13~44^2 X-Git-Url: http://git.indexdata.com/?a=commitdiff_plain;h=d6c8974147d611c767a37f9befaffc7515098caf;p=pazpar2-moved-to-github.git Fix calc. of approximation --- diff --git a/src/client.c b/src/client.c index 59fb027..eee0396 100644 --- a/src/client.c +++ b/src/client.c @@ -1327,10 +1327,9 @@ Odr_int client_get_hits(struct client *cl) 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;