To reinforce Grant's comment, lazy loading improved one situation for me on the order of 10X. I wrote it up and it's somewhere in the Wiki. Your results will vary, and unless you have a LOT of stored fields I wouldn't necessarily expect a similar speedup, but it's sure worth looking at.
And don't iterate through the Hits object for more than 100 or so hits. Like Mark said. Really. Really don't <G>... Best Erick On Wed, Feb 27, 2008 at 7:33 AM, Grant Ingersoll <[EMAIL PROTECTED]> wrote: > You could also look at the FieldSelector when getting the Document. > Such that you only load the one field you need > > -Grant > > On Feb 26, 2008, at 10:13 PM, Mark Miller wrote: > > > The Lucene prime directive: dont iterate through all of Hits! Its > > horribly inefficient. You must use a hitcollector. Even still, > > getting your field values will be slow no matter what if you get for > > every hit. You don't want to do this for every hit in a search. But > > don't loop through Hits. > > > > fangz wrote: > >> Thank you for the info. It makes sense. > >> My search will return more than 10000 documents and I have to loop > >> through > >> all documents to build a list with unique field values. It seems > >> that the > >> looping of the hits takes the longest time in the initial run but > >> afterwards > >> it becomes much faster. If the hits are relatively small, I do not > >> see the > >> same behavior. > >> > > > > --------------------------------------------------------------------- > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > For additional commands, e-mail: [EMAIL PROTECTED] > > > > -------------------------- > Grant Ingersoll > http://www.lucenebootcamp.com > Next Training: April 7, 2008 at ApacheCon Europe in Amsterdam > > Lucene Helpful Hints: > http://wiki.apache.org/lucene-java/BasicsOfPerformance > http://wiki.apache.org/lucene-java/LuceneFAQ > > > > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > >