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

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

Commit 9603aa22a5389a6ea7b8f63cb01d7ad5edfe41ae in solr's branch 
refs/heads/main from Shiming Li
[ https://gitbox.apache.org/repos/asf?p=solr.git;h=9603aa22a53 ]

SOLR-18136: fix multiThreaded=true with rerank & sort  (#4164)

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.

> 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
>          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: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to