make sure the test is run on a separate atomic readers

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1469397 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Simon Willnauer 2013-04-18 16:10:46 +00:00
parent 3ec4cf018b
commit dd0b36d053
1 changed files with 7 additions and 5 deletions

View File

@ -63,9 +63,11 @@ public class TestBlockJoin extends LuceneTestCase {
}
public void testEmptyChildFilter() throws Exception {
final Directory dir = newDirectory();
final RandomIndexWriter w = new RandomIndexWriter(random(), dir);
final IndexWriterConfig config = new IndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer(random()));
config.setMergePolicy(NoMergePolicy.NO_COMPOUND_FILES);
// we don't want to merge - since we rely on certain segment setup
final IndexWriter w = new IndexWriter(dir, config);
final List<Document> docs = new ArrayList<Document>();
@ -79,7 +81,6 @@ public class TestBlockJoin extends LuceneTestCase {
docs.add(makeJob("java", 2006));
docs.add(makeResume("Frank", "United States"));
w.addDocuments(docs);
w.commit();
int num = atLeast(10); // produce a segment that doesn't have a value in the docType field
for (int i = 0; i < num; i++) {
@ -88,9 +89,10 @@ public class TestBlockJoin extends LuceneTestCase {
w.addDocuments(docs);
}
IndexReader r = w.getReader();
IndexReader r = DirectoryReader.open(w, random().nextBoolean());
w.close();
IndexSearcher s = newSearcher(r);
assertTrue(r.leaves().size() > 1);
IndexSearcher s = new IndexSearcher(r);
Filter parentsFilter = new CachingWrapperFilter(new QueryWrapperFilter(new TermQuery(new Term("docType", "resume"))));
BooleanQuery childQuery = new BooleanQuery();