RE: Field values ...
Thu, 20 Mar 2008 11:08:36 -0400
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));
> Date: Thu, 20 Mar 2008 10:05:17 -0400
> From: erickerickson@xxxxxxxxx
> To: java-user@xxxxxxxxxxxxxxxxx
> 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.
> On Thu, Mar 20, 2008 at 9:55 AM, Dragon Fly <dragon-fly999@xxxxxxxxxxx>
> > 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