mirror of https://github.com/apache/lucene.git
LUCENE-1474: clear pendingDelCount after flushing deletes
git-svn-id: https://svn.apache.org/repos/asf/lucene/java/trunk@722645 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
eb881d5f3b
commit
cfef10bb9d
|
@ -591,6 +591,7 @@ class SegmentReader extends DirectoryIndexReader {
|
|||
deletedDocs.write(directory(), si.getDelFileName());
|
||||
|
||||
si.setDelCount(si.getDelCount()+pendingDeleteCount);
|
||||
pendingDeleteCount = 0;
|
||||
}
|
||||
if (undeleteAll && si.hasDeletions()) {
|
||||
si.clearDelGen();
|
||||
|
|
|
@ -1519,4 +1519,27 @@ public class TestIndexReader extends LuceneTestCase
|
|||
_TestUtil.rmDir(indexDir);
|
||||
}
|
||||
}
|
||||
|
||||
// LUCENE-1474
|
||||
public void testIndexReader() throws Exception {
|
||||
Directory dir = new RAMDirectory();
|
||||
IndexWriter writer = new IndexWriter(dir, new StandardAnalyzer(),
|
||||
IndexWriter.MaxFieldLength.UNLIMITED);
|
||||
writer.addDocument(createDocument("a"));
|
||||
writer.addDocument(createDocument("b"));
|
||||
writer.addDocument(createDocument("c"));
|
||||
writer.close();
|
||||
IndexReader reader = IndexReader.open(dir);
|
||||
reader.deleteDocuments(new Term("id", "a"));
|
||||
reader.flush();
|
||||
reader.deleteDocuments(new Term("id", "b"));
|
||||
reader.close();
|
||||
IndexReader.open(dir).close();
|
||||
}
|
||||
|
||||
private Document createDocument(String id) {
|
||||
Document doc = new Document();
|
||||
doc.add(new Field("id", id, Field.Store.YES, Field.Index.NOT_ANALYZED_NO_NORMS));
|
||||
return doc;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue