lucene 4: added overloaded method. To fix issue in SourceScoreOrderFragmentsBuilder and SourceSimpleFragmentsBuilder.

This commit is contained in:
Martijn van Groningen 2012-11-01 13:22:08 +01:00 committed by Shay Banon
parent 38dc19d8bc
commit e33ae96b38
1 changed files with 13 additions and 0 deletions

View File

@ -20,8 +20,11 @@
package org.elasticsearch.search.lookup;
import com.google.common.collect.ImmutableMap;
import org.apache.lucene.index.AtomicReader;
import org.apache.lucene.index.AtomicReaderContext;
import org.apache.lucene.index.IndexReader;
import org.apache.lucene.search.Scorer;
import org.elasticsearch.ElasticSearchIllegalArgumentException;
import org.elasticsearch.common.Nullable;
import org.elasticsearch.index.cache.field.data.FieldDataCache;
import org.elasticsearch.index.mapper.MapperService;
@ -77,4 +80,14 @@ public class SearchLookup {
sourceLookup.setNextDocId(docId);
fieldsLookup.setNextDocId(docId);
}
// Sneaky way fvh to get the ARC. See SourceScoreOrderFragmentsBuilder. Passed reader must be atomic.
// but that is the case in SourceScoreOrderFragmentsBuilder.
public void setNextReader(IndexReader reader) {
if (AtomicReader.class.isInstance(reader)) {
throw new ElasticSearchIllegalArgumentException("reader not instance of AtomicReader, but " + reader.getClass());
}
AtomicReaderContext context = (AtomicReaderContext) reader.getContext();
setNextReader(context);
}
}