[ 
https://issues.apache.org/jira/browse/SOLR-18541?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18133224#comment-18133224
 ] 

ASF subversion and git services commented on SOLR-18541:
--------------------------------------------------------

Commit c8abb33884cb369bfcaac47b6b02b2e1a0c850aa in solr's branch 
refs/heads/main from Nick
[ https://gitbox.apache.org/repos/asf?p=solr.git;h=c8abb33884c ]

SOLR-18541: CombinedQueryComponent.mergeIds gives wrong numFound, 
approximateTotalHits and numFoundExact (#5117)

Combined queries: skipped or failed shard responses no longer add to numFound 
or approximateTotalHits and mark numFoundExact false; approximateTotalHits no 
longer double-counts across shards.

> CombinedQueryComponent.mergeIds gives wrong numFound, approximateTotalHits 
> and numFoundExact
> --------------------------------------------------------------------------------------------
>
>                 Key: SOLR-18541
>                 URL: https://issues.apache.org/jira/browse/SOLR-18541
>             Project: Solr
>          Issue Type: Bug
>          Components: query
>            Reporter: Nick Shanin
>            Priority: Major
>              Labels: pull-request-available
>          Time Spent: 1.5h
>  Remaining Estimate: 0h
>
> 🤖 _AI text below_ 🤖 _(reviewed by Nick Shanin)_
> CombinedQueryComponent.mergeIds gives wrong numFound, approximateTotalHits 
> and numFoundExact when a shard is partial or errors.
> Three defects in the merged totals:
> 1. A partial shard's totals are added before its skip is tested. Its hits are 
> counted but its documents are dropped. With a score-only sort, a partial 
> shard with no per-query entry throws a NullPointerException.
> 2. The approximateTotalHits fallback, for a shard with no header, adds the 
> running total instead of that shard's own count.
> 3. The numFoundExact fold was inverted. SOLR-18550 (PR #5172, merged 
> 2026-10-23) fixed this on main, and it also set the rules for numFound and 
> numFoundExact with several sub-queries.
> The fix is PR #5117, rebased on main. It tests the skip before any totals are 
> added, uses the shard's own count in the fallback, and clears numFoundExact 
> for skipped and errored shards.
> Still open: QueryComponent.mergeIds has the same leak as defect 1. A real 
> timeAllowed exit can leave a shorter per-query list, and the unchecked access 
> in CombinedQueryComponent is not changed by the PR.



--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to