LUCENE-5176: Reuse new AllDeletedFilterReader in TestAddIndexes

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1514183 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Uwe Schindler 2013-08-15 07:01:25 +00:00
parent da18c280f0
commit f4356a30fe
2 changed files with 2 additions and 8 deletions

View File

@ -1229,14 +1229,7 @@ public class TestAddIndexes extends LuceneTestCase {
Directory src = newDirectory(), dest = newDirectory();
RandomIndexWriter w = new RandomIndexWriter(random(), src);
w.addDocument(new Document());
IndexReader allDeletedReader = new FilterAtomicReader(w.getReader().leaves().get(0).reader()) {
@Override
public Bits getLiveDocs() {
return new Bits.MatchNoBits(in.maxDoc());
}
@Override public boolean hasDeletions() { return true; }
@Override public int numDocs() { return 0; }
};
IndexReader allDeletedReader = new AllDeletedFilterReader(w.getReader().leaves().get(0).reader());
w.close();
w = new RandomIndexWriter(random(), dest);

View File

@ -28,6 +28,7 @@ public class AllDeletedFilterReader extends FilterAtomicReader {
public AllDeletedFilterReader(AtomicReader in) {
super(in);
liveDocs = new Bits.MatchNoBits(in.maxDoc());
assert maxDoc() == 0 || hasDeletions();
}
@Override