mirror of https://github.com/apache/lucene.git
LUCENE-1705: clear flushed doc count in deleteAll
git-svn-id: https://svn.apache.org/repos/asf/lucene/java/trunk@789651 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
ef59ce971c
commit
cefa4d0bf0
|
@ -3260,6 +3260,7 @@ public class IndexWriter {
|
|||
|
||||
// Remove any buffered docs
|
||||
docWriter.abort();
|
||||
docWriter.setFlushedDocCount(0);
|
||||
|
||||
// Remove all segments
|
||||
segmentInfos.clear();
|
||||
|
|
|
@ -297,9 +297,9 @@ public class TestIndexWriterDelete extends LuceneTestCase {
|
|||
assertEquals(7, reader.numDocs());
|
||||
reader.close();
|
||||
|
||||
// Add 2 new docs (after the deleteAll, before the commit)
|
||||
// Add a doc and update a doc (after the deleteAll, before the commit)
|
||||
addDoc(modifier, 101, value);
|
||||
addDoc(modifier, 102, value);
|
||||
updateDoc(modifier, 102, value);
|
||||
|
||||
// commit the delete all
|
||||
modifier.commit();
|
||||
|
@ -396,6 +396,18 @@ public class TestIndexWriterDelete extends LuceneTestCase {
|
|||
}
|
||||
|
||||
|
||||
private void updateDoc(IndexWriter modifier, int id, int value)
|
||||
throws IOException {
|
||||
Document doc = new Document();
|
||||
doc.add(new Field("content", "aaa", Field.Store.NO, Field.Index.ANALYZED));
|
||||
doc.add(new Field("id", String.valueOf(id), Field.Store.YES,
|
||||
Field.Index.NOT_ANALYZED));
|
||||
doc.add(new Field("value", String.valueOf(value), Field.Store.NO,
|
||||
Field.Index.NOT_ANALYZED));
|
||||
modifier.updateDocument(new Term("id", String.valueOf(id)), doc);
|
||||
}
|
||||
|
||||
|
||||
private void addDoc(IndexWriter modifier, int id, int value)
|
||||
throws IOException {
|
||||
Document doc = new Document();
|
||||
|
|
Loading…
Reference in New Issue