Description
In TopGroupsCollector#getTopGroups() method, if there're no hits for a group value, then groupMaxScore is NaN:
|
allTopDocs.scoreDocs.length == 0 ? Float.NaN : allTopDocs.scoreDocs[0].score; |
, this causes the following code Math.max(maxScore, groupMaxScore) always returns NaN in the next for loop, so the final maxScore is NaN.
|
maxScore = Math.max(maxScore, groupMaxScore); |
.
See the debug info:
We should use the same way like TopGroups#nonNANmax() to avoid that issue:
|
private static float nonNANmax(float a, float b) { |
Need to check if other places have the same issue.
Version and environment details
All versions.
Description
In TopGroupsCollector#getTopGroups() method, if there're no hits for a group value, then groupMaxScore is NaN:
lucene/lucene/grouping/src/java/org/apache/lucene/search/grouping/TopGroupsCollector.java
Line 178 in 1f0bc36
, this causes the following code Math.max(maxScore, groupMaxScore) always returns NaN in the next for loop, so the final maxScore is NaN.
lucene/lucene/grouping/src/java/org/apache/lucene/search/grouping/TopGroupsCollector.java
Line 207 in 1f0bc36
See the debug info:
We should use the same way like TopGroups#nonNANmax() to avoid that issue:
lucene/lucene/grouping/src/java/org/apache/lucene/search/grouping/TopGroups.java
Line 98 in 1f0bc36
Need to check if other places have the same issue.
Version and environment details
All versions.