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:
parent
6c189310b9
commit
1037d071bf
|
@ -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:
|
||||
|
|
Loading…
Reference in New Issue