Sorry to contradict you Yonik, but I'm pretty sure the commit lock is *not* locked during a merge, only while the "segments" file is being updated.
The merge process takes a set of 'old' segment files, writes new segment files and 'registers' them in the "segments" file when they are ready to be used. During an optimize, this proces is repeated until there is only one segment left. Every process reading or writing the "segments" file grabs the commit lock, reads the file, opens any other files it needs and releases the lock. While an IndexWriter or IndexReader is updating the index, the write lock will be set though... If this write lock is kept longer than expected you could assume a merge is in progress. A better way might be to check for segments files that are not 'registered' in the "segments" file yet. Luc -----Original Message----- From: Yonik Seeley [mailto:[EMAIL PROTECTED] Sent: donderdag 2 februari 2006 22:25 To: java-user@lucene.apache.org Subject: Re: index merging On 2/2/06, Omar Didi <[EMAIL PROTECTED]> wrote: > Thanks Yonik, > I can't set the merge factor too high because I will end up with the too many files open problem. Right. I meant only for adding a lot of documents. After a lot of adds, then you could set the mergefactor back down to a reasonable level and optimize the index. > if I change this method to only check for directory.makeLock(IndexWriter.COMMIT_LOCK_NAME).isLocked(); will this tell me that a index is merging? Yes, the commit lock will be locked when merging is going on, but you will get some false positives because the lock is used for other purposes. That may still fit your need though. -Yonik --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]