[
https://issues.apache.org/jira/browse/SOLR-18539?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
ASF GitHub Bot updated SOLR-18539:
----------------------------------
Labels: pull-request-available (was: )
> QueryComponent.mergeIds counts a partial shard whose documents are skipped in
> the merged totals, and adds the running total as the approximateTotalHits
> fallback
> ----------------------------------------------------------------------------------------------------------------------------------------------------------------
>
> Key: SOLR-18539
> URL: https://issues.apache.org/jira/browse/SOLR-18539
> Project: Solr
> Issue Type: Bug
> Components: query
> Reporter: Nick Shanin
> Priority: Major
> Labels: pull-request-available
> Time Spent: 10m
> Remaining Estimate: 0h
>
> 🤖 _AI text below_ 🤖 _(posted on behalf of Nick Shanin)_
> In a distributed search sorted on a field, {{QueryComponent.mergeIds}} folds
> each shard's totals into the merged response before it tests the
> partial-results skip, so a shard whose documents are dropped as partial still
> counts. This was confirmed by a run on unmodified main with fabricated shard
> responses: the merged list held 3 documents, but {{numFound}} was 5,
> {{numFoundExact}} was true, {{maxScore}} was 99.0 from the skipped shard, and
> {{approximateTotalHits}} was 11 instead of 4. A second defect sits in the
> same code: when a shard sends no {{approximateTotalHits}} header, the
> fallback adds the running merged total instead of that shard's own count, so
> two shards with 2 and 3 documents merged to an approximate total of 2 instead
> of 5.
> The fix I recommend is to test the skip before accumulating, so a skipped
> shard never enters the totals; subtracting its contribution afterwards cannot
> work, because a maximum such as {{maxScore}} cannot be decremented and the
> exactness flag would need recomputation. Setting {{hitCountIsExact}} to false
> when a shard is skipped would fix only the exactness symptom and leave the
> counts wrong. The fallback should also add the shard's own count instead of
> the running total, as part of the same fix.
> AI agents assisted with research, implementation, review, and drafting. Nick
> Shanin directed the work and takes responsibility for the above text.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]