You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@lucene.apache.org by "Wilton, Reece" <Re...@dig.com> on 2003/07/29 22:50:40 UTC

Safe to write while optimizing?

Three questions:
- Is it safe to have two IndexWriters open on the same index?
- Is it safe to have two IndexWriters adding a document concurrently?
- Is it safe to add a document while another IndexWriter is optimizing
the index?

---------------------------------------------------------------------
To unsubscribe, e-mail: lucene-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: lucene-user-help@jakarta.apache.org


Re: Safe to write while optimizing?

Posted by Doug Cutting <cu...@lucene.com>.
Wilton, Reece wrote:
> Three questions:
> - Is it safe to have two IndexWriters open on the same index?

No.  It is not safe, and the code makes every attempt to prohibit it.

> - Is it safe to have two IndexWriters adding a document concurrently?

No, but you can have two threads adding documents to a single 
IndexWriter concurrently.

> - Is it safe to add a document while another IndexWriter is optimizing
> the index?

No, but, so long as you use a single IndexWriter object, synchronization 
should handle things correctly so that one thread can add documents 
while another optimizes.

Doug


---------------------------------------------------------------------
To unsubscribe, e-mail: lucene-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: lucene-user-help@jakarta.apache.org