Olly Betts
2008-Jul-07 00:41 UTC
[Xapian-devel] [Xapian-commits] 10821: trunk/xapian-core/ trunk/xapian-core/api/
On Sun, Jul 06, 2008 at 11:57:40PM +0100, richard wrote:> api/omenquire.cc: When calculating percentages, round to the > nearest integer, rather than rounding down. There was a FIXME > about this, but no explanation of why it hadn't already been > done, and I can see no bad side effects so far. The most obvious > positive effect is that queries which should get precisely 100% > will no longer be assigned 99% due to rounding errors.Well, one issue is that queries which shouldn't get precisely 100% now can... I don't know how common an issue that is, but then I don't know how common the issue you mention is either. Cheers, Olly
Richard Boulton
2008-Jul-07 07:06 UTC
[Xapian-devel] [Xapian-commits] 10821: trunk/xapian-core/ trunk/xapian-core/api/
Olly Betts wrote:> On Sun, Jul 06, 2008 at 11:57:40PM +0100, richard wrote: >> api/omenquire.cc: When calculating percentages, round to the >> nearest integer, rather than rounding down. There was a FIXME >> about this, but no explanation of why it hadn't already been >> done, and I can see no bad side effects so far. The most obvious >> positive effect is that queries which should get precisely 100% >> will no longer be assigned 99% due to rounding errors. > > Well, one issue is that queries which shouldn't get precisely 100% now > can... > > I don't know how common an issue that is, but then I don't know how > common the issue you mention is either.The test case I committed yesterday suffered from this problem for me, and I've certainly seen it before (generally with large queries), but I couldn't guess at a rate at which it occurs. I don't think it's unreasonable to return 100% for a document which matches well enough to get 99.5%; and it's certainly more reasonable than returning 99% for a document which actually got 99.999999%. I suppose we could instead round up only very slightly, so that a document needed to get at least 99.9999% or so to be returned with 100%. I'm not sure whether that would be better or worse than rounding to nearest, but either is better than the rounding down which we had. -- Richard