I battled with How To Optimize Lucene a bit. Make sure you understand why you are calling Optimize. You only need to optimize to improve search performance (by limiting the number of index files which get traversed when collecting hits). The index writer will "optimize" automatically based on your MergeFactor settings. IMHO your in-flight optimizations are likely unnecessary. I also found that it was best to use the Optimize(int) overload which to select the minimum number of index files (sorry I forgot the correct term) which sped up optimization quite a lot as getting a large index into a single index file can be quite time consuming.
I found this post very educational regarding this subject: http://tim.oreilly.com/pub/a/onjava/2003/03/05/lucene.html?page=1 On Mon, Jan 24, 2011 at 12:58 PM, Trevor Watson <[email protected]>wrote: > Just a quick question regarding using the Optimize function in Lucene.NET. > > Is it more time efficient to call Optimize occasionally while adding > documents to an index, or is it better to call it at the end of adding > documents only? > > The index we are creating has a possible 2-3 million records added at a > time and we currently optimize every 100,000. > > Thanks in advance. > > Trevor Watson >
