Re: How to loop through all the entries for a field

2009-10-22 Thread Mark Miller
hetaphi.de >> >> eMail: u...@thetaphi.de >> >> >> >> >>> -Original Message- >>> >>> From: adviner [mailto:eric.advinc...@gmail.com] >>> >>> Sent: Thursday, October 22, 2009 11:20 PM >&

RE: How to loop through all the entries for a field

2009-10-22 Thread adviner
Uwe Schindler > > H.-H.-Meier-Allee 63, D-28213 Bremen > > http://www.thetaphi.de > > eMail: u...@thetaphi.de > > > >> -Original Message- > >> From: adviner [mailto:eric.advinc...@gmail.com] > >> Sent: Thursday, October 22, 2009 11:20 PM >

RE: How to loop through all the entries for a field

2009-10-22 Thread Uwe Schindler
rsday, October 22, 2009 11:20 PM > To: java-user@lucene.apache.org > Subject: Re: How to loop through all the entries for a field > > > How do you know if your on your last term? I tried it and it does work > but > continues. How do you know to check if its the l

Re: How to loop through all the entries for a field

2009-10-22 Thread adviner
nevermind I figured it out. I did this: while ((term = termEnum.Term()) != null) { if (!term.Field().Equals("BookTitle")) break; map = new SearchResultMap(); map.Title = term.Text

Re: How to loop through all the entries for a field

2009-10-22 Thread adviner
How do you know if your on your last term? I tried it and it does work but continues. How do you know to check if its the last entry? Thanks Erick Erickson wrote: > > Try something like > TermEnum te = IndexReader.terms(new Term("BookTitle", "")); > do { > Term term = te.term(); > if

Re: How to loop through all the entries for a field

2009-10-22 Thread Erick Erickson
Try something like TermEnum te = IndexReader.terms(new Term("BookTitle", "")); do { Term term = te.term(); if (! term.field().equals("BookTitle")) break; System.out.println(term.text()); } while (te.next()); Note that next() will merrily continue beyond the last term for the field "Bo