You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@lucenenet.apache.org by "Andrew C. Smith" <po...@gmail.com> on 2009/04/02 23:42:07 UTC

Re: (Newbie) How can I programmatically find the number of indexed documents?

I think you want to take a look at the
numDocs()<http://lucene.apache.org/java/2_4_1/api/core/org/apache/lucene/index/IndexReader.html#numDocs%28%29>method
off of the
IndexReader<http://lucene.apache.org/java/2_4_1/api/core/org/apache/lucene/index/IndexReader.html>
.

an example may be something like this.

Directory dir = FSDirectory.GetDirectory("DirectoryLocation");

IndexReader ir = IndexReader.Open(dir);

int numberOfDocuments = ir.numDocs();



2009/4/2 Rémi Després-Smyth <re...@terracognita.ca>

> I’m using Lucene.Net with NHibernate, very new at it.
>
>
>
> Is there any way to programmatically determine the number of documents that
> are indexed?  I want to setup a few unit tests to ensure that my indexing
> code works properly.
>
>
>
> Thanks.
>
> Rémi
>
>
>
>