mirror of https://github.com/apache/lucene.git
LUCENE-3478: ensure the epsilon is always at least a tiny size for crazy small scores
git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1178819 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
c1be69731d
commit
76fd471b54
|
@ -37,6 +37,14 @@ public class CheckHits {
|
|||
* this allows for a small amount of relative variation
|
||||
*/
|
||||
public static float EXPLAIN_SCORE_TOLERANCE_DELTA = 0.001f;
|
||||
|
||||
/**
|
||||
* In general we use a relative epsilon, but some tests do crazy things
|
||||
* like boost documents with 0, creating tiny tiny scores where the
|
||||
* relative difference is large but the absolute difference is tiny.
|
||||
* we ensure the the epsilon is always at least this big.
|
||||
*/
|
||||
public static float EXPLAIN_SCORE_TOLERANCE_MINIMUM = 1e-6f;
|
||||
|
||||
/**
|
||||
* Tests that all documents up to maxDoc which are *not* in the
|
||||
|
@ -306,7 +314,7 @@ public class CheckHits {
|
|||
}
|
||||
|
||||
private static float explainToleranceDelta(float f1, float f2) {
|
||||
return Math.max(Math.abs(f1), Math.abs(f2)) * EXPLAIN_SCORE_TOLERANCE_DELTA;
|
||||
return Math.max(EXPLAIN_SCORE_TOLERANCE_MINIMUM, Math.max(Math.abs(f1), Math.abs(f2)) * EXPLAIN_SCORE_TOLERANCE_DELTA);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue