mirror of https://github.com/apache/lucene.git
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:
parent
da18c280f0
commit
f4356a30fe
|
@ -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);
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue