hi,

the IndexReader class provides some public static methodes to check if an index is locked. If this is the case, there is also a method to unlock an existing index. You could do something like:

Directory dir = FSDirectory.getDirectory(indexDir, false);
if (IndexReader.isLocked(dir)) {
   IndexReader.unlock(dir);
}
dir.close();

You also should catch the possible IOException in case of an error or the index can't be unlocked.

fun with it
Bernhard

[EMAIL PROTECTED] wrote:

Hi,
I experienced following situation:

Suddenly my query became too slow (c.10sec instead of c.1sec) and the number of returned hits changed from c. 2000 to c.1800.

Tracing the case I've found locking file "abc.......-commit.lck". After deletion of this file everything turned back to normal behavior, i.e. I got my 2000 hits in 1sec.

There were no concurent writing or reading processes running parallely.

Probably the lock file was lost because of abnormal termination ( during development it's ok, but may happen in production as well)
My question is how to handle such situation, find out and repair in case it happens (in real life there are many concurensy processes and I have no idea which lock file to kill).








---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to