lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Doug Cutting <>
Subject RE: Index Locked For Write
Date Tue, 26 Feb 2002 23:28:57 GMT
> From: Hayes, Mark []
> I understand there are three modes for using IndexReader and 
> IndexWriter:
> A- IndexReader for reading only, not deleting
> B- IndexReader for deleting (and reading)
> C- IndexWriter (for adding and optimizing)

That sounds right.

> Any number of readers may be used concurrently in mode A.


> But for B and C
> the reader or writer may not be kept open for long periods.

The length of time doesn't really matter.  What matters is that only one of
B or C can be done at once.  That's to say, only a single process/thread may
modify an index at once.  Modification should be single threaded.

> Therefore for B and C each set of changes should be made inside a
> synchronized block where the reader or writer is opened and 
> closed.

That, or B and C should be done from a single flow of control.  The most
efficient update approach is to batch deletions and insertions.


To unsubscribe, e-mail:   <>
For additional commands, e-mail: <>

View raw message