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