lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From eks dev <>
Subject Re: Fastest Method for Searching (need all results)
Date Fri, 21 Jul 2006 20:11:37 GMT
have you tried to only collect doc-ids and see if the speed problem is there, or maybe to fetch
only field values? If you have dense results it can easily be split() or addSymbolsToHash()
what takes the time.

I see 3 possibilities what could be slow,  getting doc-ids, fetching field value or doing
something with this value

Would be interesting to know what you get here 

yeah, I know, it sounds to naive, but sometimes  repeting the obvious helps

----- Original Message ----
From: Ryan O'Hara <>
Sent: Friday, 21 July, 2006 8:43:41 PM
Subject: Fastest Method for Searching (need all results)

My index contains approximately 5 millions documents.  During a  
search, I need to grab the value of a field for every document in the  
result set.  I am currently using a HitCollector to search.  Below is  
my code:, new HitCollector(){
                         public void collect(int doc, float score){
                                 if(searcher.doc(doc).get("SYM") !=  

This is fairly fast for small and medium-sized result sets.  However,  
it gets slow as the result set grows.  I read this on HitCollector's  
API page:

"For good search performance, implementations of this method should  
not call Searcher.doc(int) or Reader.document(int) on every document  
number encountered. Doing so can slow searches by an order of  
magnitude or more."

Along with this implementation, I've also tried using FieldCache.   
This faired better with large-sized result sets, but worse with small  
and medium-sized result sets.  Anyone have any ideas of what the best  
approach might be?

Thanks a lot,

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message