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 Alex Aw Seat Kiong <al...@bigonthenet.com> on 2004/07/06 03:44:34 UTC

How to use QueryParser to query to get the index summary info?

Hi!

How to use QueryParser to query to get the index summary info, like?
a. Last and first index document? 
b. Size of each document was indexed?
b. Total size of all documents were indexed?
c. Total count of all documents were indexed?
Anyone know about it?

Thanks.

Regards,
Alex

Re: How to use QueryParser to query to get the index summary info?

Posted by Erik Hatcher <er...@ehatchersolutions.com>.
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