You should open the IndexWriter with autoCommit=false, then make
changes.  During this time, any reader that opens the index will not
see any changes you are making.

Then, you can call close() to commit the changes to the index, or
abort() to rollback the index to the starting state (when the writer
was opened).

Note that in 3.0, IndexWriter will be hardwired to autoCommit=false
(in trunk those ctors taking autoCommit are deprecated) and a new
commit() method can be used to periodically commit without closing if
you want to.

Mike

Sergey Kabashnyuk <[EMAIL PROTECTED]> wrote:
> Hi.
>  I have a question about transactions  in Lucene.
>
>  Lets say I have 1000 Documents and want to add all of them or none of
>  them(if something happen) to the index.
>
>  What the best strategy to do it in multithreaded environment?
>
>  Sergey Kabashnyuk.
>
>  ---------------------------------------------------------------------
>  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]

Reply via email to