Re: Problems about using Lucene to generate tag cloud..

2008-04-06 Thread wuqi
Very useful.. Thank you!

- Original Message - 
From: "John Wang" <[EMAIL PROTECTED]>
To: 
Sent: Saturday, April 05, 2008 8:35 AM
Subject: Re: Problems about using Lucene to generate tag cloud..


check out http://www.browseengine.com
tag cloud impl on lucene is avail.

-John

On Wed, Apr 2, 2008 at 4:12 PM, Daniel Noll <[EMAIL PROTECTED]> wrote:

> On Thursday 03 April 2008 08:08:09 Dominique Béjean wrote:
> > Hum, it looks like it is not true.
> > Use a do-while loop make the first terms.term().field() generate a null
> > pointer exception.
>
> Depends which terms method you use.
>
>TermEnum terms = reader.terms();
>System.out.println(terms.term());   => null
>
>terms = reader.terms(new Term("id", ""));
>System.out.println(terms.term());   => id:0
>
> The first method makes a normal while loop work but it also makes the
> assumption that there is only one field in the index, which may not be the
> case forever even if it's the case initially.
>
> Daniel
>
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>


Re: Problems about using Lucene to generate tag cloud..

2008-04-06 Thread Marvin Humphrey


On Apr 1, 2008, at 2:57 PM, Daniel Noll wrote:

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. :-(


What would a better API look like?

Marvin Humphrey
Rectangular Research
http://www.rectangular.com/


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]