[ 
https://issues.apache.org/jira/browse/SOLR-18541?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

David Smiley updated SOLR-18541:
--------------------------------
    Fix Version/s: 9.12
                   10.2

> 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
>             Fix For: 9.12, 10.2
>
>          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