revert speedup, the wrapping causes fc insanity. the only reason this works today is that a new index is created in every setup/teardown, which also makes these tests slow...

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1137601 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Robert Muir 2011-06-20 12:00:12 +00:00
parent 532f443146
commit 66dd8290c0
1 changed files with 13 additions and 24 deletions

View File

@ -148,35 +148,23 @@ public class QueryUtils {
// we can't put deleted docs before the nested reader, because // we can't put deleted docs before the nested reader, because
// it will throw off the docIds // it will throw off the docIds
IndexReader[] readers = new IndexReader[] { IndexReader[] readers = new IndexReader[] {
edge < 0 ? r : emptyReaders[0], edge < 0 ? r : IndexReader.open(makeEmptyIndex(random, 0), true),
emptyReaders[0], IndexReader.open(makeEmptyIndex(random, 0), true),
new MultiReader(edge < 0 ? emptyReaders[4] : emptyReaders[0], new MultiReader(IndexReader.open(makeEmptyIndex(random, edge < 0 ? 4 : 0), true),
emptyReaders[0], IndexReader.open(makeEmptyIndex(random, 0), true),
0 == edge ? r : emptyReaders[0]), 0 == edge ? r : IndexReader.open(makeEmptyIndex(random, 0), true)),
0 < edge ? emptyReaders[0] : emptyReaders[7], IndexReader.open(makeEmptyIndex(random, 0 < edge ? 0 : 7), true),
emptyReaders[0], IndexReader.open(makeEmptyIndex(random, 0), true),
new MultiReader(0 < edge ? emptyReaders[0] : emptyReaders[5], new MultiReader(IndexReader.open(makeEmptyIndex(random, 0 < edge ? 0 : 5), true),
emptyReaders[0], IndexReader.open(makeEmptyIndex(random, 0), true),
0 < edge ? r : emptyReaders[0]) 0 < edge ? r : IndexReader.open(makeEmptyIndex(random, 0), true))
}; };
IndexSearcher out = LuceneTestCase.newSearcher(new MultiReader(readers)); IndexSearcher out = LuceneTestCase.newSearcher(new MultiReader(readers));
out.setSimilarityProvider(s.getSimilarityProvider()); out.setSimilarityProvider(s.getSimilarityProvider());
return out; return out;
} }
static final IndexReader[] emptyReaders = new IndexReader[8]; private static Directory makeEmptyIndex(Random random, final int numDeletedDocs)
static {
try {
emptyReaders[0] = makeEmptyIndex(new Random(0), 0);
emptyReaders[4] = makeEmptyIndex(new Random(0), 4);
emptyReaders[5] = makeEmptyIndex(new Random(0), 5);
emptyReaders[7] = makeEmptyIndex(new Random(0), 7);
} catch (IOException ex) {
throw new RuntimeException(ex);
}
}
private static IndexReader makeEmptyIndex(Random random, final int numDeletedDocs)
throws IOException { throws IOException {
Directory d = new MockDirectoryWrapper(random, new RAMDirectory()); Directory d = new MockDirectoryWrapper(random, new RAMDirectory());
IndexWriter w = new IndexWriter(d, new IndexWriterConfig( IndexWriter w = new IndexWriter(d, new IndexWriterConfig(
@ -200,7 +188,8 @@ public class QueryUtils {
IndexReader r = IndexReader.open(d, true); IndexReader r = IndexReader.open(d, true);
Assert.assertEquals("reader has wrong number of deleted docs", Assert.assertEquals("reader has wrong number of deleted docs",
numDeletedDocs, r.numDeletedDocs()); numDeletedDocs, r.numDeletedDocs());
return r; r.close();
return d;
} }
/** alternate scorer skipTo(),skipTo(),next(),next(),skipTo(),skipTo(), etc /** alternate scorer skipTo(),skipTo(),next(),next(),skipTo(),skipTo(), etc