Skip to content

TopGroupsCollector#getTopGroups() returns NaN maxScore when no hits for a group value #15872

@gaobinlong

Description

@gaobinlong

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.
.

See the debug info:

Image

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions