You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@lucene.apache.org by Shai Erera <se...@gmail.com> on 2008/01/11 13:42:22 UTC
Retrieve the number of deleted documents
Hi
I didn't find a proper API on InderWriter or IndexReader to retrieve the
total number of deleted documents.
Will IndexReader.maxDocs() - IndexReader.numDocs() give the correct result?
or this is just a heuristic?
Thanks,
Shai
Re: Retrieve the number of deleted documents
Posted by Shai Erera <se...@gmail.com>.
Thanks
I guess I should have looked in the code before asking those silly questions
:-)
I wonder why there isn't a specific API for that though ...
On Jan 11, 2008 7:36 PM, Steven A Rowe <sa...@syr.edu> wrote:
> Hi Shai,
>
> On 01/11/2008 at 7:42 AM, Shai Erera wrote:
> > Will IndexReader.maxDocs() - IndexReader.numDocs() give the
> > correct result? or this is just a heuristic?
>
> I think your expression gives the correct result - the abstract
> IndexReader.numDocs() method is implemented in SegmentReader as:
>
> public int numDocs() {
> // Don't call ensureOpen() here (it could affect performance)
> int n = maxDoc();
> if (deletedDocs != null)
> n -= deletedDocs.count();
> return n;
> }
>
> Steve
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
> For additional commands, e-mail: java-user-help@lucene.apache.org
>
>
--
Regards,
Shai Erera
RE: Retrieve the number of deleted documents
Posted by Steven A Rowe <sa...@syr.edu>.
Hi Shai,
On 01/11/2008 at 7:42 AM, Shai Erera wrote:
> Will IndexReader.maxDocs() - IndexReader.numDocs() give the
> correct result? or this is just a heuristic?
I think your expression gives the correct result - the abstract IndexReader.numDocs() method is implemented in SegmentReader as:
public int numDocs() {
// Don't call ensureOpen() here (it could affect performance)
int n = maxDoc();
if (deletedDocs != null)
n -= deletedDocs.count();
return n;
}
Steve
---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org