lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Erik Hatcher <e...@ehatchersolutions.com>
Subject Re: How to use QueryParser to query to get the index summary info?
Date Tue, 06 Jul 2004 11:24:44 GMT
On Jul 5, 2004, at 9:44 PM, Alex Aw Seat Kiong wrote:
> How to use QueryParser to query to get the index summary info, like?

QueryParser is not the appropriate place to get the information you 
want.  Use IndexReader instead.

> a. Last and first index document?

reader.document(0) and reader.document(reader.numDocs() - 1)  (assuming 
an optimized index with no deleted documents).

> b. Size of each document was indexed?

Lucene won't really be able to help, I don't think.  If you need this 
type of information, you probably should tally it during indexing.  You 
could certainly do some tricks with IndexReader to determine how terms 
and bytes and such a document takes up in Lucene, but I'm not sure that 
would be the best solution for what you're after.

> b. Total size of all documents were indexed?

Again, probably should tally this during indexing.  If you want to know 
the index size, look at the file system and see how big the files in 
the index directory are.  This is not the size of the original 
documents indexed - in fact, Lucene would really have no way of knowing 
that.

> c. Total count of all documents were indexed?

IndexReader.numDocs()

	Erik


---------------------------------------------------------------------
To unsubscribe, e-mail: lucene-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: lucene-user-help@jakarta.apache.org


Mime
View raw message