On Tue, Jan 19, 2010 at 8:04 PM, jchang <jchangkihat...@gmail.com> wrote: > > The javadocs for IndexSearcher in Lucene 3.0.0 read: "For performance > reasons it is recommended to open only one IndexSearcher and use it for all > of your searches."
As Uwe pointed out, creating an IndexSearcher from an already created IndexReader is very cheap. > However, to use NRT, it seems I have to do this for every search, which > contradicts the advice above: > IndexSearcher myIndexSearcher = new > IndexSearcher(myIndexWriter.getReader()); You should test for yourself (and please report back!), but... if you have a large index, and you are actively changing the index, and those changes include any deletions (or calls to IW.updateDocument), creating a new NRT reader for every search will likely be too costly at high search load. > Is there any way to take advantage of NRT and not run into these performance > problems under heavy load? It's usually best to throttle how often a new NRT reader is created to something like 10X per second (but test yourself to see...). > Is the advice from the javadoc above aimed more at > IndexSearcher(org.apache.lucene.store.Directory directory)? Or is it also > aimed at IndexSearcher(org.apache.lucene.index.IndexReader indexReader), > which I believe I have to use to get NRT (correct me if I am wrong)? The former. Mike --------------------------------------------------------------------- To unsubscribe, e-mail: java-dev-unsubscr...@lucene.apache.org For additional commands, e-mail: java-dev-h...@lucene.apache.org