X-Git-Url: http://git.indexdata.com/?p=idzebra-moved-to-github.git;a=blobdiff_plain;f=rset%2Frsmultiandor.c;h=fd7ed2b08ae5396b2df3c3ede851f38e880a7add;hp=91669dbf7f952bef02be30f64dd0a29fffdb1edb;hb=d513d15e315601b730b0b3a6126c3163d00223fb;hpb=a66b7d79383ae700f3358731eecfe2aafed0e90d diff --git a/rset/rsmultiandor.c b/rset/rsmultiandor.c index 91669db..fd7ed2b 100644 --- a/rset/rsmultiandor.c +++ b/rset/rsmultiandor.c @@ -1,5 +1,5 @@ /* This file is part of the Zebra server. - Copyright (C) 1994-2010 Index Data + Copyright (C) 1994-2011 Index Data Zebra is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free @@ -32,6 +32,9 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ +#if HAVE_CONFIG_H +#include +#endif #include #include #include @@ -613,11 +616,12 @@ static void r_pos_x(RSFD rfd, double *current, double *total, int and_op) (struct rfd_private *)(rfd->priv); double ratio = and_op ? 0.0 : 1.0; int i; + double sum_cur = 0.0; + double sum_tot = 0.0; for (i = 0; ino_children; i++){ double nratio, cur, tot; rset_pos(mrfd->items[i].fd, &cur, &tot); yaz_log(log_level, "r_pos: %d %0.1f %0.1f", i, cur,tot); - nratio = cur / tot; if (and_op) { @@ -626,10 +630,12 @@ static void r_pos_x(RSFD rfd, double *current, double *total, int and_op) } else { - if (nratio < ratio) - ratio = nratio; + sum_cur += cur; + sum_tot += tot; } } + if (!and_op) + ratio = sum_cur / sum_tot; if (ratio == 0.0 || ratio == 1.0) { /* nothing there */ *current = 0; *total = 0;