lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Cecilio Cano Calonge" <...@canal21.com>
Subject Count all words in a index
Date Thu, 19 Jun 2003 13:38:03 GMT
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi, all

I want to count all words in a index. I do this:

- ---------------------------
        IndexReader reader = IndexReader.open( "MyIndex" );
        TermEnum terminos = reader.terms();

	int countWords = 0;
        while( terminos.next() ) {
               TermDocs td = reader.termDocs( terminos.term() );
                while( td.next() )  countWords += td.freq();
        }
- ----------------------------

but this is very slow in a large document number.  
Could somebody say to me how to do this of another faster form? 

Thank you very much in advance.
 
- -- 
Cecilio Cano Calonge ยท Czy 
GNUpg Key = 5011 67C7 7C0B A513 C18F  D93B 071B BA7C 9DF6 9399
 
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.1 (GNU/Linux)

iD8DBQE+8bzCBxu6fJ32k5kRAma9AJ4889mq5ewNRDV0NxLTV12TgRgVewCfaGZ5
9nsvgL/TL+kSFPb9krXfg6A=
=Lmji
-----END PGP SIGNATURE-----


---------------------------------------------------------------------
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