diff --git a/lucene/src/java/org/apache/lucene/index/IndexWriter.java b/lucene/src/java/org/apache/lucene/index/IndexWriter.java index 83de1c1a969..0e00d47a859 100644 --- a/lucene/src/java/org/apache/lucene/index/IndexWriter.java +++ b/lucene/src/java/org/apache/lucene/index/IndexWriter.java @@ -1219,7 +1219,7 @@ public class IndexWriter implements Closeable { for (int i = 0; i < segmentInfos.size(); i++) { final SegmentInfo info = segmentInfos.info(i); - count += info.docCount - info.getDelCount(); + count += info.docCount - numDeletedDocs(info); } return count; } diff --git a/lucene/src/test/org/apache/lucene/index/TestNRTThreads.java b/lucene/src/test/org/apache/lucene/index/TestNRTThreads.java index a10983ef579..170516e5cb4 100644 --- a/lucene/src/test/org/apache/lucene/index/TestNRTThreads.java +++ b/lucene/src/test/org/apache/lucene/index/TestNRTThreads.java @@ -316,7 +316,7 @@ public class TestNRTThreads extends LuceneTestCase { System.out.println("TEST: done join [" + (System.currentTimeMillis()-t0) + " ms]; addCount=" + addCount + " delCount=" + delCount); } writer.commit(); - assertEquals(addCount.get() - delCount.get(), writer.numDocs()); + assertEquals("index=" + writer.segString(), addCount.get() - delCount.get(), writer.numDocs()); writer.close(false); dir.close();