Fix unscored-unsorted collectors
This commit is contained in:
parent
586be8751c
commit
328a45f40d
@ -10,6 +10,7 @@ import java.util.List;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
import java.util.concurrent.locks.LockSupport;
|
||||
import org.apache.lucene.index.LeafReaderContext;
|
||||
import org.apache.lucene.search.Collector;
|
||||
import org.apache.lucene.search.CollectorManager;
|
||||
import org.apache.lucene.search.IndexSearcher;
|
||||
@ -44,10 +45,11 @@ public class UnscoredUnsortedContinuousLuceneMultiSearcher implements LuceneMult
|
||||
class IterableCollector extends SimpleCollector {
|
||||
|
||||
private int shardIndex;
|
||||
private LeafReaderContext context;
|
||||
|
||||
@Override
|
||||
public void collect(int i) {
|
||||
var scoreDoc = new ScoreDoc(i, 0, shardIndex);
|
||||
var scoreDoc = new ScoreDoc(context.docBase + i, 0, shardIndex);
|
||||
synchronized (scoreDocsSink) {
|
||||
while (scoreDocsSink.tryEmitNext(scoreDoc) == EmitResult.FAIL_OVERFLOW) {
|
||||
LockSupport.parkNanos(10);
|
||||
@ -55,6 +57,11 @@ public class UnscoredUnsortedContinuousLuceneMultiSearcher implements LuceneMult
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void doSetNextReader(LeafReaderContext context) throws IOException {
|
||||
this.context = context;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ScoreMode scoreMode() {
|
||||
return ScoreMode.COMPLETE_NO_SCORES;
|
||||
|
Loading…
Reference in New Issue
Block a user