Are you sure you can't make the reader reopen block on a reindex? Or skip reopen if reindex is in process?
(Because that's the simplest solution). If not, I think the next best solution is likely to allow multiple commit points in the index. You'll need a custom deletion policy that always keeps the "last commit point that's safe to reopen" in the index. Then a reindex can gleefully proceed since the last "safe to reopen" commit point will not be deleted. If a reader wants to reopen, you ask it to reopen on that "last safe commit point". But these APIs (reopen to a commit point) are only available in 2.9 trunk. You can emulate this in prior releases by using separate indexing directories in the filesystem. Mike On Wed, Apr 29, 2009 at 5:53 AM, Paul Taylor <paul_t...@fastmail.fm> wrote: > Michael McCandless wrote: >> >> Lucene doesn't have anything builtin to handle this. >> >> It's probably best to put synchronization into your code in such a >> case? It's presumably also not great if your IndexReader opens an >> empty index since searches will find no results. Ie, you should >> probably only reopen the IndexReader after all docs have been >> reindexed? >> >> Or you could catch a failure to open the IndexReader and retry, but >> that's not great since differentiating a true failure isn't easy. >> >> Mike >> >> > > I can synchronize the reindex method but I dont think that will help because > the problem is with the readers, the trouble is that I have various threads, > and sometimes IndexReaders are being opened in reponse to something done on > the GUI, without being aware that a reindex is being done. I think I need to > get any IndexReader opens to wait for any reindexing to complete using > something in the Concurrent Package. Or alternatively I was wondering if the > reindex could be done on a different folder, so Indexreaders opened in the > meantime work on the old index, than once the reindexd has completed I can > swap the directory that the reader looks at to the new one. > > > Which do you think would work ? > Paul > --------------------------------------------------------------------- To unsubscribe, e-mail: java-user-unsubscr...@lucene.apache.org For additional commands, e-mail: java-user-h...@lucene.apache.org