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

Tomoko Uchida commented on LUCENE-9129:
---------------------------------------

It's not a bug but an intended change related to this optimization. 
 https://issues.apache.org/jira/browse/LUCENE-4100

The issue isn't mentioned in "API Changes" but "Optimizations" section on the 
Change log: 
[https://lucene.apache.org/core/8_0_0/changes/Changes.html|https://lucene.apache.org/core/8_4_0/changes/Changes.html].
 Although it includes API changes, I think the location is appropriate for the 
main purpose of the issue.

In short, you need to implement {{Collector#scoreMode()}} and also discard 
{{#needsScores()}} when upgrading to Lucene 8.0+ as the log message says. 
 See: 
[https://lucene.apache.org/core/8_0_0/core/org/apache/lucene/search/Collector.html]

Since there were many changes/optimizations between 7.x and 8.x, it's hard to 
make an exhaustive list for every breaking change in the APIs (in addition, the 
{{Collector}} interface is marked as "Expert:", that means this is for expert 
users who are familiar with Lucene internals). So could you refer the Javadocs 
when you encounter errors relating to the library version upgrade. The Git 
commit log and diff command will also be help for getting more detailed 
information.

 

 

> Updating from 7.X to 8.X breaks
> -------------------------------
>
>                 Key: LUCENE-9129
>                 URL: https://issues.apache.org/jira/browse/LUCENE-9129
>             Project: Lucene - Core
>          Issue Type: Bug
>            Reporter: xia0c
>            Priority: Major
>
> Hi, during my upgrading process from 7.X to 8.X I found another code break. 
> {code:java}
> import org.apache.lucene.analysis.Analyzer;
> import org.apache.lucene.index.LeafReaderContext;
> import org.apache.lucene.index.MultiDocValues;
> import org.apache.lucene.index.SortedDocValues;
> import org.apache.lucene.search.IndexSearcher;
> import org.apache.lucene.search.Query;
> import org.apache.lucene.search.SimpleCollector;
> import org.apache.lucene.search.TopDocs;
> import org.apache.lucene.util.LongValues;
> import org.apache.solr.handler.component.FacetComponent.FacetContext;
> import org.apache.solr.search.DocSet;
> import org.apache.solr.search.DocSetUtil;
> import org.apache.lucene.index.IndexReader;
> public class TestLucene {
>       
>       private FacetContext fcontext;
>       private DocSet docs;
>       private IndexReader reader;
>       
>       
>       public void demo() throws  IOException {
>                               
>             DocSetUtil.collectSortedDocSet(docs, reader, new 
> SimpleCollector() {
>                 @Override 
>                 public boolean needsScores() { return false; }
>                 @Override
>                 protected void doSetNextReader(LeafReaderContext ctx) throws 
> IOException {
>                         // TODO
>                 }
>                       @Override
>                       public void collect(int doc) throws IOException {
>                               // TODO Auto-generated method stub
>                               
>                       }
>               });
>       
>       }
> }
> {code}
> The code should pass before, but it throws an error:
> {code:java}
> [ERROR] /TestLucene.java:[32,82] <anonymous TestLucene$1> is not abstract and 
> does not override abstract method scoreMode() in 
> org.apache.lucene.search.Collector
> [ERROR] /TestLucene.java:[36,19] method does not override or implement a 
> method from a supertype
> {code}
> I try to find changes in the migration 
> guide(https://github.com/apache/lucene-solr/blob/branch_8x/lucene/MIGRATE.txt)
>  but I didn't find it. 



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

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

Reply via email to