From 102d64b6e147d9bca7298abf857febdb41106ee8 Mon Sep 17 00:00:00 2001 From: Dennis Schafroth Date: Thu, 12 Apr 2012 18:10:38 +0200 Subject: [PATCH] Support for approximation --- src/session.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/session.c b/src/session.c index fde1e78..18c9aee 100644 --- a/src/session.c +++ b/src/session.c @@ -963,6 +963,7 @@ static struct hitsbytarget *hitsbytarget_nb(struct session *se, res[*count].id = client_get_id(cl); res[*count].name = *name ? name : "Unknown"; res[*count].hits = client_get_hits(cl); + res[*count].approximation = client_get_approximation(cl); res[*count].records = client_get_num_records(cl); res[*count].filtered = client_get_num_records_filtered(cl); res[*count].diagnostic = @@ -1044,6 +1045,8 @@ static int targets_termlist_nb(WRBUF wrbuf, struct session *se, int num, ht[i].hits); if (version >= 2) { + // Should not print if we know it isn't a approximation. + wrbuf_printf(wrbuf, "" ODR_INT_PRINTF "\n", ht[i].approximation); wrbuf_printf(wrbuf, "%d\n", ht[i].records); wrbuf_printf(wrbuf, "%d\n", ht[i].filtered); } @@ -1186,7 +1189,7 @@ void show_single_stop(struct session *se, struct record_cluster *rec) struct record_cluster **show_range_start(struct session *se, struct reclist_sortparms *sp, - int start, int *num, int *total, Odr_int *sumhits) + int start, int *num, int *total, Odr_int *sumhits, Odr_int *approx_hits) { struct record_cluster **recs; struct reclist_sortparms *spp; @@ -1219,9 +1222,10 @@ struct record_cluster **show_range_start(struct session *se, *total = reclist_get_num_records(se->reclist); *sumhits = 0; - for (l = se->clients_active; l; l = l->next) + for (l = se->clients_active; l; l = l->next) { *sumhits += client_get_hits(l->client); - + *approx_hits += client_get_approximation(l->client); + } for (i = 0; i < start; i++) if (!reclist_read_record(se->reclist)) { -- 1.7.10.4