LUCENE-3606: fix faceting tests

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/branches/lucene3606@1210489 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Robert Muir 2011-12-05 15:05:26 +00:00
parent 1dc3a251c4
commit 8e77a1e5e1
3 changed files with 4 additions and 20 deletions

View File

@ -323,19 +323,6 @@ public class TestTotalFacetCountsCache extends LuceneTestCase {
assertTrue("Should be obtained from cache at 8th attempt",totalCounts ==
TFC.getTotalCounts(readers[0].indexReader, readers[0].taxReader, iParams, null));
// delete a doc from the reader and commit - should recompute
origReader.close();
origReader = readers[0].indexReader;
readers[0].indexReader = IndexReader.open(origReader.directory(),false);
initCache();
totalCounts = TFC.getTotalCounts(readers[0].indexReader, readers[0].taxReader, iParams, null);
prevGen = assertRecomputed(totalCounts, prevGen, "after opening a writable reader - 9th attempt!");
// now do the delete
readers[0].indexReader.deleteDocument(1);
readers[0].indexReader.commit(null);
totalCounts = TFC.getTotalCounts(readers[0].indexReader, readers[0].taxReader, iParams, null);
prevGen = assertRecomputed(totalCounts, prevGen, "after deleting docs the index - 10th attempt!");
origReader.close();
readers[0].close();
r2.close();

View File

@ -147,7 +147,7 @@ public class TestIndexClose extends LuceneTestCase {
}
@Override
protected IndexReader openIndexReader(Directory dir) throws CorruptIndexException, IOException {
return new InstrumentedIndexReader(IndexReader.open(dir,true));
return new InstrumentedIndexReader(IndexReader.open(dir));
}
}

View File

@ -231,14 +231,11 @@ public class TestScoredDocIDsUtils extends LuceneTestCase {
for (int docNum = 0; docNum < nDocs; docNum++) {
writer.addDocument(docFactory.getDoc(docNum));
}
// Delete documents marked for deletion
writer.deleteDocuments(new Term(DocumentFactory.field, DocumentFactory.delTxt));
writer.close();
// Delete documents marked for deletion
IndexReader reader = IndexReader.open(dir, false);
reader.deleteDocuments(new Term(DocumentFactory.field, DocumentFactory.delTxt));
reader.close();
// Open a fresh read-only reader with the deletions in place
return IndexReader.open(dir, true);
return IndexReader.open(dir);
}
}