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

ASF GitHub Bot updated SOLR-17322:
----------------------------------
    Labels: pull-request-available  (was: )

> Make RankQuery.getTopDocsCollector use covariant generic types
> --------------------------------------------------------------
>
>                 Key: SOLR-17322
>                 URL: https://issues.apache.org/jira/browse/SOLR-17322
>             Project: Solr
>          Issue Type: Bug
>      Security Level: Public(Default Security Level. Issues are Public) 
>          Components: search
>    Affects Versions: 9.0, 9.1, 9.2, 9.1.1, 9.3, 9.2.1, 9.4, 9.5, 9.4.1, 9.6, 
> 9.6.1
>            Reporter: Stephen Woods
>            Assignee: Christine Poerschke
>            Priority: Trivial
>              Labels: pull-request-available
>             Fix For: 9.7
>
>          Time Spent: 2h 40m
>  Remaining Estimate: 0h
>
> Currently, rank queries can only use TopDocsCollectors that operate on 
> ScoreDocs.
> TopDocsCollector has a class signature of: 
> {code:java}
> public abstract class TopDocsCollector<T extends ScoreDoc> implements 
> Collector {code}
> It contains a single covariant generic type T, which allows the collection of 
> not only ScoreDocs, but subclasses of ScoreDocs as well (in the event 
> additional information needs to be collected per document during the 
> collection process).
> SOLR-15385 involved a large commit that removed raw types from much of the 
> Solr code base. As part of that work, RankQuery was modified so that the 
> getTopDocsCollector method no longer returns a raw TopDocsCollector but 
> instead returns a TopDocsCollector of invariant ScoreDocs. Unfortunately, by 
> doing so, it is no longer possible to use custom TopDocsCollectors that 
> operate on types that extend ScoreDoc in rank queries; they _only_ work with 
> ScoreDocs. Any attempt to use a class other than ScoreDoc will result in a 
> compilation error.
> The fix for this issue is very simple: Modify the method signature from:
> {code:java}
>  public abstract TopDocsCollector<ScoreDoc> getTopDocsCollector(
>       int len, QueryCommand cmd, IndexSearcher searcher) throws IOException; 
> {code}
> to
> {code:java}
> public abstract TopDocsCollector<? extends ScoreDoc> getTopDocsCollector(
>       int len, QueryCommand cmd, IndexSearcher searcher) throws IOException;  
> {code}
> The call site for this method, within 
> SolrIndexSearcher.buildTopDocsCollector, already uses this type signature.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@solr.apache.org
For additional commands, e-mail: issues-h...@solr.apache.org

Reply via email to