Why didn't you switch the IndexSearcher when you were done with the second index?
When you are done reindexing in the second directory, your queries switch from the IndexSearcher that
performed its searches on the old index, to the new IndexSearcher pointing to the new index.
This way, no locks on the search threads, the threads that had a search going will finish it on the old index.
Next time you index you use the old directory again, and so on.


Lars Klevan wrote:

When we do full rebuilds we build into a new Directory.  When it is
ready we create a commit lock on the active directory to block new
searches, sleep for a half-second to let exisitng searches finish, and
then copy the newly built directory over the old one.  This seemed to
avoid file system lock issues on windows and unix and ongoing searches
just wait for the commit lock to be released.

-Lars

To create the commit lock:

FSDirectory activeDirectory;
Lock searchLock;
try {
   searchLock = activeDirectory.makeLock(IndexWriter.COMMIT_LOCK_NAME);
   ... do the copy
} finally {
   searchLock.release();
}

-----Original Message-----
From: Vladimir Yuryev [mailto:[EMAIL PROTECTED]
Sent: Wednesday, July 28, 2004 6:09 AM
To: Lucene Users List
Subject: Re: continous index update


Jitender

Use task manager.

Regards,
Vladimir.

On Wed, 28 Jul 2004 16:13:51 +0530
"jitender ahuja" <[EMAIL PROTECTED]> wrote:


Hi,
I am working on Windows platform and I think it wouldn't work there.
If it can, do please tell me.


Regards,

----- Original Message ----- From: "Vladimir Yuryev" <[EMAIL PROTECTED]>
To: "Lucene Users List" <[EMAIL PROTECTED]>
Sent: Wednesday, July 28, 2004 3:17 PM
Subject: Re: continous index update





Hi!

I do automatic index update by cron daemon.

Regards,
Vladimir.

On Wed, 28 Jul 2004 15:05:46 +0530
"jitender ahuja" <[EMAIL PROTECTED]> wrote:


Hi all,
I am trying to make an automatic index update file based


o


a background thread, but it gives errors in deleting the existing
index, if (only if) the server accesses the index at the same time


or


has once accessed it and even if a different request is posed, i.e.
for a different index directory or a different job, it makes no
difference.
Can anyone tell that in such a continous update scenario, how the


old


index can be updated as I feel deletion is a must of the earlier
contents so as to get the new contents in place.

Regards,
Jitender


---------------------------------------------------------------------
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]





---------------------------------------------------------------------
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