lucene 4: Upgraded ScanContext.
This commit is contained in:
parent
41325113f0
commit
09fe15488d
|
@ -1,8 +1,10 @@
|
|||
package org.elasticsearch.search.scan;
|
||||
|
||||
import com.google.common.collect.Maps;
|
||||
import org.apache.lucene.index.AtomicReaderContext;
|
||||
import org.apache.lucene.index.IndexReader;
|
||||
import org.apache.lucene.search.*;
|
||||
import org.apache.lucene.util.Bits;
|
||||
import org.elasticsearch.common.lucene.docset.AllDocSet;
|
||||
import org.elasticsearch.search.internal.SearchContext;
|
||||
|
||||
|
@ -89,7 +91,7 @@ public class ScanContext {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void setNextReader(IndexReader reader, int docBase) throws IOException {
|
||||
public void setNextReader(AtomicReaderContext context) throws IOException {
|
||||
// if we have a reader state, and we haven't registered one already, register it
|
||||
// we need to check in readersState since even when the filter return null, setNextReader is still
|
||||
// called for that reader (before)
|
||||
|
@ -98,8 +100,8 @@ public class ScanContext {
|
|||
readerState.done = true;
|
||||
readerStates.put(currentReader, readerState);
|
||||
}
|
||||
this.currentReader = reader;
|
||||
this.docBase = docBase;
|
||||
this.currentReader = context.reader();
|
||||
this.docBase = context.docBase;
|
||||
this.readerState = new ReaderState();
|
||||
}
|
||||
|
||||
|
@ -130,13 +132,13 @@ public class ScanContext {
|
|||
}
|
||||
|
||||
@Override
|
||||
public DocIdSet getDocIdSet(IndexReader reader) throws IOException {
|
||||
ReaderState readerState = readerStates.get(reader);
|
||||
public DocIdSet getDocIdSet(AtomicReaderContext context, Bits acceptedDocs) throws IOException {
|
||||
ReaderState readerState = readerStates.get(context.reader());
|
||||
if (readerState != null && readerState.done) {
|
||||
scanCollector.incCounter(readerState.count);
|
||||
return null;
|
||||
}
|
||||
return new AllDocSet(reader.maxDoc());
|
||||
return new AllDocSet(context.reader().maxDoc());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue