On Mon, 2007-08-20 at 11:41 -0700, Chris Hostetter wrote:
> : > 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)
Ok, I wasn't aware of that - I thought that Ards while loop would be
wrong, but this was a wrong asumption on my side ;)

Thanx a lot for pointing this out! I implemented it like this and
changed my range calculation to be based on already sorted prices,
which makes a huge difference: now the range calculation for 2M
search results takes only about 30% of the time compared to reading
it from ValueSource and sorting them manually! Now it's as fast as
all other facets -- me very happy now *g*

Thanx a lot for all your help,
cheers,
Martin


> 
> 
> -Hoss
> 

Attachment: signature.asc
Description: This is a digitally signed message part

Reply via email to