LUCENE-3487: use a relative delta for comparing BS2 vs BS2 with minShouldMatch

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1181474 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Robert Muir 2011-10-11 02:11:46 +00:00
parent d526a4c699
commit 51c1a461a8
2 changed files with 4 additions and 2 deletions

View File

@ -313,7 +313,9 @@ public class CheckHits {
}
private static float explainToleranceDelta(float f1, float f2) {
/** returns a reasonable epsilon for comparing two floats,
* where minor differences are acceptable such as score vs. explain */
public static float explainToleranceDelta(float f1, float f2) {
return Math.max(EXPLAIN_SCORE_TOLERANCE_MINIMUM, Math.max(Math.abs(f1), Math.abs(f2)) * EXPLAIN_SCORE_TOLERANCE_DELTA);
}

View File

@ -359,7 +359,7 @@ public class TestBooleanMinShouldMatch extends LuceneTestCase {
+ CheckHits.topdocsString(top1,0,0)
+ CheckHits.topdocsString(top2,0,0)
+ "for query:" + q2.toString(),
score, otherScore, 1.0e-6f);
score, otherScore, CheckHits.explainToleranceDelta(score, otherScore));
}
}