mirror of https://github.com/apache/lucene.git
make MultiDocValues.getSorted more efficient
git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/branches/lucene4547@1436472 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
275b1caa00
commit
39e77a6f8e
|
@ -22,6 +22,7 @@ import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.apache.lucene.codecs.Codec;
|
import org.apache.lucene.codecs.Codec;
|
||||||
|
import org.apache.lucene.index.FieldInfo.DocValuesType;
|
||||||
import org.apache.lucene.index.IndexReader.ReaderClosedListener;
|
import org.apache.lucene.index.IndexReader.ReaderClosedListener;
|
||||||
import org.apache.lucene.store.Directory;
|
import org.apache.lucene.store.Directory;
|
||||||
import org.apache.lucene.store.RAMDirectory;
|
import org.apache.lucene.store.RAMDirectory;
|
||||||
|
@ -174,6 +175,9 @@ public class MultiDocValues {
|
||||||
config.setCodec(Codec.forName("SimpleText"));
|
config.setCodec(Codec.forName("SimpleText"));
|
||||||
IndexWriter writer = new IndexWriter(scratch, config);
|
IndexWriter writer = new IndexWriter(scratch, config);
|
||||||
List<AtomicReader> newLeaves = new ArrayList<AtomicReader>();
|
List<AtomicReader> newLeaves = new ArrayList<AtomicReader>();
|
||||||
|
// fake up fieldinfos
|
||||||
|
FieldInfo fi = new FieldInfo(field, false, 0, false, false, false, null, DocValuesType.SORTED, null, null);
|
||||||
|
final FieldInfos fis = new FieldInfos(new FieldInfo[] { fi });
|
||||||
for (AtomicReaderContext ctx : leaves) {
|
for (AtomicReaderContext ctx : leaves) {
|
||||||
final AtomicReader a = ctx.reader();
|
final AtomicReader a = ctx.reader();
|
||||||
newLeaves.add(new FilterAtomicReader(a) {
|
newLeaves.add(new FilterAtomicReader(a) {
|
||||||
|
@ -189,6 +193,22 @@ public class MultiDocValues {
|
||||||
public boolean hasDeletions() {
|
public boolean hasDeletions() {
|
||||||
return false; // lie
|
return false; // lie
|
||||||
}
|
}
|
||||||
|
@Override
|
||||||
|
public FieldInfos getFieldInfos() {
|
||||||
|
return fis;
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public Fields getTermVectors(int docID) throws IOException {
|
||||||
|
return null; // lie
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public void document(int docID, StoredFieldVisitor visitor) throws IOException {
|
||||||
|
// lie
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public Fields fields() throws IOException {
|
||||||
|
return null; // lie
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
writer.addIndexes(newLeaves.toArray(new AtomicReader[0]));
|
writer.addIndexes(newLeaves.toArray(new AtomicReader[0]));
|
||||||
|
|
|
@ -41,7 +41,6 @@ import org.apache.lucene.util._TestUtil;
|
||||||
/**
|
/**
|
||||||
* Tests IndexSearcher's searchAfter() method
|
* Tests IndexSearcher's searchAfter() method
|
||||||
*/
|
*/
|
||||||
// nocommit fail w/ OOME?: ant test -Dtestcase=TestSearchAfter -Dtests.method=testQueries -Dtests.seed=98B4DA915983D1AE -Dtests.slow=true -Dtests.locale=sr -Dtests.timezone=Etc/GMT+2 -Dtests.file.encoding=UTF-8
|
|
||||||
public class TestSearchAfter extends LuceneTestCase {
|
public class TestSearchAfter extends LuceneTestCase {
|
||||||
private Directory dir;
|
private Directory dir;
|
||||||
private IndexReader reader;
|
private IndexReader reader;
|
||||||
|
|
Loading…
Reference in New Issue