dblock commented on a change in pull request #711:
URL: https://github.com/apache/lucene/pull/711#discussion_r818077386
##########
File path:
lucene/core/src/java/org/apache/lucene/search/MaxScoreSumPropagator.java
##########
@@ -131,22 +131,28 @@ void setMinCompetitiveScore(float minScore) throws
IOException {
/** Return the minimum score that a Scorer must produce in order for a hit
to be competitive. */
private float getMinCompetitiveScore(float minScoreSum, double
sumOfOtherMaxScores) {
assert numClauses > 0;
- if (minScoreSum <= sumOfOtherMaxScores) {
- return 0f;
- }
// We need to find a value 'minScore' so that 'minScore +
sumOfOtherMaxScores <= minScoreSum'
// TODO: is there an efficient way to find the greatest value that meets
this requirement?
float minScore = (float) (minScoreSum - sumOfOtherMaxScores);
- int iters = 0;
- while (scoreSumUpperBound(minScore + sumOfOtherMaxScores) > minScoreSum) {
+ for (int iter = 0;
+ minScore > 0 && scoreSumUpperBound(minScore + sumOfOtherMaxScores) >
minScoreSum;
+ ++iter) {
// Important: use ulp of minScoreSum and not minScore to make sure that
we
// converge quickly.
minScore -= Math.ulp(minScoreSum);
// this should converge in at most two iterations:
// - one because of the subtraction rounding error
// - one because of the error introduced by sumUpperBound
- assert ++iters <= 2 : iters;
+ if (iter > 2) {
+ throw new IllegalStateException(
Review comment:
I included this part of https://github.com/jpountz/lucene/pull/2.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]