From 39e77a6f8eab33f8d015a85f6c81f5331ee900f0 Mon Sep 17 00:00:00 2001 From: Robert Muir Date: Mon, 21 Jan 2013 16:40:02 +0000 Subject: [PATCH] make MultiDocValues.getSorted more efficient git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/branches/lucene4547@1436472 13f79535-47bb-0310-9956-ffa450edef68 --- .../apache/lucene/index/MultiDocValues.java | 20 +++++++++++++++++++ .../apache/lucene/search/TestSearchAfter.java | 1 - 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/lucene/core/src/java/org/apache/lucene/index/MultiDocValues.java b/lucene/core/src/java/org/apache/lucene/index/MultiDocValues.java index c7c13feaa77..e2ebb342601 100644 --- a/lucene/core/src/java/org/apache/lucene/index/MultiDocValues.java +++ b/lucene/core/src/java/org/apache/lucene/index/MultiDocValues.java @@ -22,6 +22,7 @@ import java.util.ArrayList; import java.util.List; import org.apache.lucene.codecs.Codec; +import org.apache.lucene.index.FieldInfo.DocValuesType; import org.apache.lucene.index.IndexReader.ReaderClosedListener; import org.apache.lucene.store.Directory; import org.apache.lucene.store.RAMDirectory; @@ -174,6 +175,9 @@ public class MultiDocValues { config.setCodec(Codec.forName("SimpleText")); IndexWriter writer = new IndexWriter(scratch, config); List newLeaves = new ArrayList(); + // 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) { final AtomicReader a = ctx.reader(); newLeaves.add(new FilterAtomicReader(a) { @@ -189,6 +193,22 @@ public class MultiDocValues { public boolean hasDeletions() { 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])); diff --git a/lucene/core/src/test/org/apache/lucene/search/TestSearchAfter.java b/lucene/core/src/test/org/apache/lucene/search/TestSearchAfter.java index 4392e6d96ba..d6b0b289b36 100644 --- a/lucene/core/src/test/org/apache/lucene/search/TestSearchAfter.java +++ b/lucene/core/src/test/org/apache/lucene/search/TestSearchAfter.java @@ -41,7 +41,6 @@ import org.apache.lucene.util._TestUtil; /** * 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 { private Directory dir; private IndexReader reader;