[TEST] fixes InternalTopHitsTests test to initialize the SearchHits

maxScore to Float.NaN if there is no max score, as that is what Lucene's
TopDocs does
This commit is contained in:
Ali Beyad 2017-04-13 18:27:42 -04:00
parent 13489ff3a7
commit 5e54c0261a
1 changed files with 2 additions and 1 deletions

View File

@ -155,7 +155,8 @@ public class InternalTopHitsTests extends InternalAggregationTestCase<InternalTo
for (int i = 0; i < expectedHitsHits.length; i++) {
expectedHitsHits[i] = allHits.get(i).v2();
}
SearchHits expectedHits = new SearchHits(expectedHitsHits, totalHits, maxScore);
// Lucene's TopDocs initializes the maxScore to Float.NaN, if there is no maxScore
SearchHits expectedHits = new SearchHits(expectedHitsHits, totalHits, maxScore == Float.MIN_VALUE ? Float.NaN : maxScore);
assertEqualsWithErrorMessageFromXContent(expectedHits, actualHits);
}