diff --git a/CHANGES.txt b/CHANGES.txt index e2922e71738..a9b8006833c 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -154,6 +154,8 @@ API Changes NO_NORMS becomes NOT_ANALYZED_NO_NORMS and a new ANALYZED_NO_NORMS is added. (Mike McCandless) +24. LUCENE-1131: Added numDeletedDocs method to IndexReader (Otis Gospodnetic) + Bug fixes 1. LUCENE-1134: Fixed BooleanQuery.rewrite to only optimize a single diff --git a/src/java/org/apache/lucene/index/IndexReader.java b/src/java/org/apache/lucene/index/IndexReader.java index a934a82ca67..394b46620c0 100644 --- a/src/java/org/apache/lucene/index/IndexReader.java +++ b/src/java/org/apache/lucene/index/IndexReader.java @@ -622,6 +622,11 @@ public abstract class IndexReader { */ public abstract int maxDoc(); + /** Returns the number of deleted documents. */ + public int numDeletedDocs() { + return maxDoc() - numDocs(); + } + /** Returns the stored fields of the nth Document in this index. * @throws CorruptIndexException if the index is corrupt