diff options
author | Jim Ferenczi <jim.ferenczi@elastic.co> | 2017-02-21 18:18:44 +0100 |
---|---|---|
committer | Jim Ferenczi <jim.ferenczi@elastic.co> | 2017-02-21 18:18:44 +0100 |
commit | 1ba9770037c29c41cd6ee306957842e00489c320 (patch) | |
tree | 8d3366f9628c2ce2df9e32dc20003c072485fbf0 /core/src/main/java/org/elasticsearch | |
parent | 5e4ba4a60ecc1169e86c1dd517ed05a225c5278b (diff) |
Fix comparaison of double in InternalTopHits
InternalTopHits uses "==" to compare hit scores and fails when score is NaN.
This commit changes the comparaison to always use Double.compare.
Relates #23253
Diffstat (limited to 'core/src/main/java/org/elasticsearch')
-rw-r--r-- | core/src/main/java/org/elasticsearch/search/aggregations/metrics/tophits/InternalTopHits.java | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/core/src/main/java/org/elasticsearch/search/aggregations/metrics/tophits/InternalTopHits.java b/core/src/main/java/org/elasticsearch/search/aggregations/metrics/tophits/InternalTopHits.java index 81216af23e..de37e1a62d 100644 --- a/core/src/main/java/org/elasticsearch/search/aggregations/metrics/tophits/InternalTopHits.java +++ b/core/src/main/java/org/elasticsearch/search/aggregations/metrics/tophits/InternalTopHits.java @@ -173,7 +173,7 @@ public class InternalTopHits extends InternalMetricsAggregation implements TopHi ScoreDoc thisDoc = topDocs.scoreDocs[d]; ScoreDoc otherDoc = other.topDocs.scoreDocs[d]; if (thisDoc.doc != otherDoc.doc) return false; - if (thisDoc.score != otherDoc.score) return false; + if (Double.compare(thisDoc.score, otherDoc.score) != 0) return false; if (thisDoc.shardIndex != otherDoc.shardIndex) return false; if (thisDoc instanceof FieldDoc) { if (false == (otherDoc instanceof FieldDoc)) return false; |