Thank you
Uwe Schindler wrote: > > Use this one: > > > > String fieldname="BookTitle"; > > > > fieldname = fieldname.intern(); // because of this we need no > String.equals() > > TermEnum te = IndexReader.terms(new Term(fieldname, "")); > > do { > > Term term = te.term(); > > if (term == null || term.field() != fieldname) break; > > System.out.println(term.text()); > > } while (te.next()); > > te.close(); > > > > ----- > > 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 > >> 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 last entry? > >> > >> Thanks > >> > >> > >> Erick Erickson wrote: > >> > > >> > 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 "BookTitle", so you have to check that you're still > >> > where you want to be. > >> > > >> > > >> > Best > >> > Erick > >> > > >> > On Thu, Oct 22, 2009 at 11:52 AM, adviner <eric.advinc...@gmail.com> > >> > wrote: > >> > > >> >> > >> >> I have a field in called BookTitle. I want to loop through all the > >> >> entries > >> >> without doing a search. I just want to get the list of BookTitle's > >> that > >> >> is > >> >> in this field: > >> >> > >> >> I tried IndexReader but MaxDocs() doesnt work because it returns > >> >> everything > >> >> and I have other fields in their which is allot bigger. > >> >> > >> >> > >> >> Sorry i originally posted to the developer site which is wrong place >> so > >> i > >> >> moved it here > >> >> -- > >> >> View this message in context: > >> >> http://www.nabble.com/How-to-loop-through-all-the-entries-for-a-field- > >> tp26012512p26012512.html > >> >> Sent from the Lucene - Java Users mailing list archive at Nabble.com. > >> >> > >> >> > >> >> --------------------------------------------------------------------- > >> >> To unsubscribe, e-mail: java-user-unsubscr...@lucene.apache.org > >> >> For additional commands, e-mail: java-user-h...@lucene.apache.org > >> >> > >> >> > >> > > >> > > >> > >> -- > >> View this message in context: http://www.nabble.com/How-to-loop-through- > >> all-the-entries-for-a-field-tp26012512p26017418.html > >> Sent from the Lucene - Java Users mailing list archive at Nabble.com. > >> > >> > >> --------------------------------------------------------------------- > >> To unsubscribe, e-mail: java-user-unsubscr...@lucene.apache.org > >> For additional commands, e-mail: java-user-h...@lucene.apache.org > > > > > -- View this message in context: http://www.nabble.com/How-to-loop-through-all-the-entries-for-a-field-tp26012512p26017581.html Sent from the Lucene - Java Users mailing list archive at Nabble.com. --------------------------------------------------------------------- To unsubscribe, e-mail: java-user-unsubscr...@lucene.apache.org For additional commands, e-mail: java-user-h...@lucene.apache.org