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.