Fix bug in explain for function_score queries.

The explain output for function_score queries with score_mode=max or
score_mode=min was incorrect, returning instead the value of the last
function.  This change fixes this.
This commit is contained in:
Richard Boulton 2013-12-10 13:38:41 +00:00 committed by Britta Weber
parent 6c189310b9
commit 1037d071bf
1 changed files with 4 additions and 4 deletions

View File

@ -202,15 +202,15 @@ public class FiltersFunctionScoreQuery extends Query {
factor = filterExplanations.get(0).getValue();
break;
case Max:
double maxFactor = Double.NEGATIVE_INFINITY;
factor = Double.NEGATIVE_INFINITY;
for (int i = 0; i < filterExplanations.size(); i++) {
factor = Math.max(filterExplanations.get(i).getValue(), maxFactor);
factor = Math.max(filterExplanations.get(i).getValue(), factor);
}
break;
case Min:
double minFactor = Double.POSITIVE_INFINITY;
factor = Double.POSITIVE_INFINITY;
for (int i = 0; i < filterExplanations.size(); i++) {
factor = Math.min(filterExplanations.get(i).getValue(), minFactor);
factor = Math.min(filterExplanations.get(i).getValue(), factor);
}
break;
case Multiply: