Skip to content

Skip max score computation when sorting by relevance in BlockGroupingCollector#15942

Open
gaobinlong wants to merge 2 commits intoapache:mainfrom
gaobinlong:bgcMaxScore
Open

Skip max score computation when sorting by relevance in BlockGroupingCollector#15942
gaobinlong wants to merge 2 commits intoapache:mainfrom
gaobinlong:bgcMaxScore

Conversation

@gaobinlong
Copy link
Copy Markdown
Contributor

@gaobinlong gaobinlong commented Apr 8, 2026

Description

In BlockGroupingCollector.getTopGroups(), we firstly compute the groupMaxScore by iterating on each group docs to get the max value, then compute the totalMaxScore by Math.max(maxScore, groupMaxScore), both can be optimized when the sort is by relevance.

For the groupMaxScore, we can get the maxScore from the top scoreDoc in the merged top docs. For the totalMaxScore, we can get it from the groups[0] directly if sort by relevance.

Performance benchmark:

  TaskQPS baseline      StdDevQPS my_modified_version      StdDev                Pct diff p-value
                    TermBGroup1M       63.31      (9.3%)       64.90      (6.5%)    2.5% ( -12% -   20%) 0.325
                  TermBGroup1M1P      203.86     (12.9%)      211.23     (18.2%)    3.6% ( -24% -   39%) 0.468

…Collector

Signed-off-by: Binlong Gao <gbinlong@amazon.com>
@github-actions github-actions bot added this to the 10.5.0 milestone Apr 8, 2026
Signed-off-by: Binlong Gao <gbinlong@amazon.com>
@gaobinlong
Copy link
Copy Markdown
Contributor Author

Hi @benwtrent , please help to review this PR when you're convenient, thanks!

Copy link
Copy Markdown
Member

@benwtrent benwtrent left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

simple enough, I like it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants