LUCENE-2809: use del count from reader if it's pooled, in IW.numDocs

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1044505 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Michael McCandless 2010-12-10 20:55:19 +00:00
parent ab3b6ced80
commit cf12c2d1d3
2 changed files with 2 additions and 2 deletions

View File

@ -1219,7 +1219,7 @@ public class IndexWriter implements Closeable {
for (int i = 0; i < segmentInfos.size(); i++) { for (int i = 0; i < segmentInfos.size(); i++) {
final SegmentInfo info = segmentInfos.info(i); final SegmentInfo info = segmentInfos.info(i);
count += info.docCount - info.getDelCount(); count += info.docCount - numDeletedDocs(info);
} }
return count; return count;
} }

View File

@ -316,7 +316,7 @@ public class TestNRTThreads extends LuceneTestCase {
System.out.println("TEST: done join [" + (System.currentTimeMillis()-t0) + " ms]; addCount=" + addCount + " delCount=" + delCount); System.out.println("TEST: done join [" + (System.currentTimeMillis()-t0) + " ms]; addCount=" + addCount + " delCount=" + delCount);
} }
writer.commit(); writer.commit();
assertEquals(addCount.get() - delCount.get(), writer.numDocs()); assertEquals("index=" + writer.segString(), addCount.get() - delCount.get(), writer.numDocs());
writer.close(false); writer.close(false);
dir.close(); dir.close();