From 8d02d7859f9a5ae8d1cd5ceefccd274cb294cc72 Mon Sep 17 00:00:00 2001 From: Otis Gospodnetic Date: Mon, 15 Sep 2008 15:33:15 +0000 Subject: [PATCH] LUCENE-1131 - Added numDeletedDocs() to IndexReader git-svn-id: https://svn.apache.org/repos/asf/lucene/java/trunk@695510 13f79535-47bb-0310-9956-ffa450edef68 --- CHANGES.txt | 2 ++ src/java/org/apache/lucene/index/IndexReader.java | 5 +++++ 2 files changed, 7 insertions(+) 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