lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dragon Fly <dragon-fly...@hotmail.com>
Subject RE: Field values ...
Date Thu, 20 Mar 2008 15:08:36 GMT
I was able to get a list of all the values for the Id field and another list of all the values
for the Phone field using TermEnum (i.e. two independent lists).  However, what I really wanted
was:

- Get the first Id
- Get the Phone associated with the first Id.
- Get the second Id
- Get the Phone associated with the second Id.
...
...

I want to do something like:

    List<Info> infoList = new ArrayList<Info> ();
    foreach (Document doc in LuceneIndex)
    {
       String id = doc.get ("Id");
       String phone = doc.get ("Phone");
       infoList.add (new Info (id, phone));
    }

Thank you.

> Date: Thu, 20 Mar 2008 10:05:17 -0400
> From: erickerickson@gmail.com
> To: java-user@lucene.apache.org
> Subject: Re: Field values ...
> 
> See TermDocs/TermEnum. The trick is to start one of your enumerations
> with "" (I forget exactly which), and that'll iterate them all.
> 
> Best
> Erick
> 
> On Thu, Mar 20, 2008 at 9:55 AM, Dragon Fly <dragon-fly999@hotmail.com>
> wrote:
> 
> > What's the easiest way to extract the values of 2 fields from each
> > document in the index.  For example, each document has 5 fields:
> >    Id     Name     Address     Phone     Preference
> > I'd like to extract the values for the Id and Phone fields for each
> > document in the index.  Thank you.
> >
> > _________________________________________________________________
> > Watch "Cause Effect," a show about real people making a real difference.
> >  Learn more.
> > http://im.live.com/Messenger/IM/MTV/?source=text_watchcause

_________________________________________________________________
Test your Star IQ
http://club.live.com/red_carpet_reveal.aspx?icid=redcarpet_HMTAGMAR
Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message