[prev in list] [next in list] [prev in thread] [next in thread] 

List:       lucene-user
Subject:    Count all words in a index
From:       "Cecilio Cano Calonge" <czy () canal21 ! com>
Date:       2003-06-19 13:38:03
[Download RAW message or body]

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


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic