in Ian's link, particularly see the section "Don't iterate over morehits than necessary".
A couple of other things: 1> Loading the entire document just to get a field or two isn't very efficient, think about lazy loading (See FieldSelector) 2> What do you mean when you say "not very good"? Using too much memory? Slow? Perhaps if you gave us a higher level idea of what you're trying to accomplish we could make better suggestions. Best Erick On Tue, Jun 30, 2009 at 5:02 AM, Ian Lea <ian....@gmail.com> wrote: > What exactly is the problem? Are you concerned about the time that > your code snippet takes to run, or how much memory it uses? > > If you have a query that matches many documents then iterating through > all of them, as your code does, is inevitably going to take time. See > http://wiki.apache.org/lucene-java/ImproveSearchingSpeed for > suggestions. > > It is unclear why your code snippet would use a lot of memory. Are > you maybe storing all the titles in memory? > > > -- > Ian. > > > > On Tue, Jun 30, 2009 at 7:01 AM, m.harig<m.ha...@gmail.com> wrote: > > > > hello all, > > > > i've gone through most of the posts from this forum , i need a code > > snippet for searching large index, currently am iterating , > > > > hits = searher.search(query); > > for (int inc = 0; inc < hits.length(); inc++) { > > > > Document doc = hits.doc(inc); > > > > String title = doc.get("title"); > > > > /// etc....... > > } > > > > > > its not good by the way when you use large index. am running it from > tomcat > > 6 .0 , java heap space is 256 MB , > > please any1 help me > > > > > > > > -- > > View this message in context: > http://www.nabble.com/optimized-searching-tp24266553p24266553.html > > Sent from the Lucene - Java Users mailing list archive at Nabble.com. > > > > > > --------------------------------------------------------------------- > > To unsubscribe, e-mail: java-user-unsubscr...@lucene.apache.org > > For additional commands, e-mail: java-user-h...@lucene.apache.org > > > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: java-user-unsubscr...@lucene.apache.org > For additional commands, e-mail: java-user-h...@lucene.apache.org > >