: > TermEnum terms = searcher.getReader().terms(new Term(field, ""));
: >     while (terms.term() != null && terms.term().field() == field){
: >             //do things
: >             terms.next();
: >     }

:     while( te.next() ) {
:         final Term term = te.term();


you're missing the key piece that Ard alluded to ... the there is one
ordere list of all terms stored in the index ... a TermEnum lets you
iterate over this ordered list, and the IndexReader.terms(Term) method
lets you efficiently start at an arbitrary term.  if you are only
interested in terms for a specific field, once your TermEnum returns a
differnet field, you can stop -- you will never get any more terms for
the field you care about (hence Ard's terms.term().field() == field in his
loop conditional)


-Hoss

Reply via email to