lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "wenjie zheng" <>
Subject Problem when deleting files from index
Date Sun, 05 Mar 2006 01:36:34 GMT
 My program loops thru a list of email records, first searches in index for
its docid.
Once it gets the docid, it will try to remove the doc from the index.

The problem I ran into was:
4 out 10 times I ran the program, I got "Lock obtain timed out:
Lock@/tmp/lucene-6c36cae1cb524a61cdbb38a32f2ef684-write.lock" on the last
email record I tried to delete.
5 out 10 times it finished just fine.
1 out 10 times it got Lock error when there were more than one email records
left to delete (there are totally 29 docs in the index)

Here is the code:
int i = 0;
Iterator<EmailRecord> it = v.iterator(); //v is the vector contains email
EmailRecord eml = (EmailRecord);
// local search function to get the docId, searcher and Directory are closed
after search is done
int docid =;
// if doc not found, change the status updator
if(docid == SystemConfig.ERROR_DOC_NOT_FOUND){
// update database entry
updator.setStatus(i, SystemConfig.ERROR_DOC_NOT_FOUND);
Directory indexDir = null;
IndexModifier modifier = null;
indexDir = FSDirectory.getDirectory(index, false);
modifier = new IndexModifier(indexDir, new StandardAnalyzer(), false);

modifier.flush(); // make sure all the changes pushed to the disk
}catch(IOException e){
logger.error("Cannot delete " + docid + " th doc from the index: " +
eml.getUsername() + " " + e.getMessage());
updator.setStatus(i, SystemConfig.ERROR_CANNOT_DELETE);
// try to sleep between two deletions
}catch(InterruptedException e){
logger.error("Cannot sleep after one deletion... " + e.getMessage());



  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message