lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dominique Béjean <dominique.bej...@eolya.fr>
Subject RE: Problems about using Lucene to generate tag cloud..
Date Wed, 02 Apr 2008 21:08:09 GMT
Hum, it looks like it is not true.
Use a do-while loop make the first terms.term().field() generate a null
pointer exception.

-----Message d'origine-----
De : Daniel Noll [mailto:daniel@nuix.com] 
Envoyé : mardi 1 avril 2008 23:58
À : java-user@lucene.apache.org
Objet : Re: Problems about using Lucene to generate tag cloud..

On Tuesday 01 April 2008 18:51:55 Dominique Béjean wrote:
>         IndexReader reader = IndexReader.open(temp_index);
>         TermEnum terms = reader.terms();
>
>         while (terms.next()) {
>             String field = terms.term().field();

Gotcha: after calling terms() it's already pointing at the first term.  So
you 
need to rewrite this as a do-while loop.

Possibly my least favourite feature of Lucene. :-(

Daniel

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



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


Mime
View raw message