lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "suman.holani" <suman.hol...@zapak.co.in>
Subject document object
Date Thu, 10 Mar 2011 09:31:10 GMT
 

Hi,

 

I am facing the  problem 

 

The line in the loop is going very slow giving me a performance hit

  for (int i = 0; i < hits.length; ++i) {

                

                int docId = hits[i].doc;

                Document d = searcher.doc(docId);  //problem

}

 

How can I improve this. Please give me an example of the improved code

 

Thanks,

Suman

 

 

Ps :

In one of post Erick said ..

 

this line is really suspicious: 

Document document = this.indexReader.document(doc) 

>From the Javadoc for HitCollector.collect: 

Note: This is called in an inner search loop. For good search performance, 
implementations of this method should not call 
Searcher.doc(int)<file:///C:/lucene-2.1.0/docs/api/org/apache/lucene/search/
Searcher.html#doc%28int%29>or 
IndexReader.document(int)<file:///C:/lucene-2.1.0/docs/api/org/apache/lucene
/index/IndexReader.html#document%28int%29>on 
every document number encountered. Doing so can slow searches by an 
order 
of magnitude or more.

 

 

 

 


Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message