You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@solr.apache.org by "David Smiley (Jira)" <ji...@apache.org> on 2026/03/24 04:34:00 UTC
[jira] [Resolved] (SOLR-18136) ArrayStoreException in MultiThreadedSearcher when combining rerank with sort and parallel segment search
[ https://issues.apache.org/jira/browse/SOLR-18136?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
David Smiley resolved SOLR-18136.
---------------------------------
Fix Version/s: 10.1
9.11
Resolution: Fixed
Thanks for contributing!
> ArrayStoreException in MultiThreadedSearcher when combining rerank with sort and parallel segment search
> --------------------------------------------------------------------------------------------------------
>
> Key: SOLR-18136
> URL: https://issues.apache.org/jira/browse/SOLR-18136
> Project: Solr
> Issue Type: Bug
> Affects Versions: main(11.0), 9.10.1
> Reporter: Shiming Li
> Priority: Major
> Labels: pull-request-available
> Fix For: 10.1, 9.11
>
> Time Spent: 10m
> Remaining Estimate: 0h
>
> *Summary*
> When multi-threaded segment-parallel search is enabled (`indexSearcherExecutorThreads > 0` and `multiThreaded=true`)
> and a query uses both reranking (via `RankQuery` / `ReRankCollector`) and a sort, an `ArrayStoreException` is
> thrown during the merge phase if some segments have matching documents and others do not.
>
> *Error Message*
> {code:java}
> java.lang.ArrayStoreException: arraycopy: element type mismatch: can not cast one of the elements
> of org.apache.lucene.search.TopDocs[] to the type of the destination array,
> org.apache.lucene.search.TopFieldDocs
> {code}
>
> *Root Cause*
> In `MultiThreadedSearcher.TopDocsCM.reduce()`, the code decides how to merge `TopDocs` from
> different slices based solely on the type of `topDocs[0]`:
> {code:java}
> if (topDocs[0] instanceof TopFieldDocs) {
> TopFieldDocs[] topFieldDocs = Arrays.copyOf(topDocs, topDocs.length, TopFieldDocs[].class);
> ...
> }
> {code}
> When a ReRankCollector is used with a sort:
> Empty-result segments return TopFieldDocs (from the underlying TopFieldCollector)
> Non-empty segments return plain TopDocs (after ReRankCollector.toRescoredDocs() wraps
> results with new TopDocs(...), discarding the TopFieldDocs subtype)
> When Lucene splits segments into multiple slices for parallel search, different slices may produce
> different TopDocs subtypes. If an empty-result slice happens to be first in the array,
> topDocs[0] is TopFieldDocs, and Arrays.copyOf(..., TopFieldDocs[].class) fails because the
> array also contains plain TopDocs elements.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For additional commands, e-mail: issues-help@solr.apache.org