I kept getting this exception when adding a new document to an existing index:
22:19:10,281 INFO [STDOUT] java.io.IOException: Lock obtain timed out: [EMAIL PROTECTED]:\DOCUME~1\xin\LOCALS~ 1\Temp\lucene-31c482aaf5f581ad3dc0249eeeb8d281-write.lock (Stack trace is like: 22:19:10,312 INFO [STDOUT] at org.apache.lucene.store.Lock.obtain(Lock.java:58) 22:19:10,312 INFO [STDOUT] at org.apache.lucene.index.IndexWriter.<init>(IndexWriter.java:223) 22:19:10,312 INFO [STDOUT] at org.apache.lucene.index.IndexWriter.<init>(IndexWriter.java:173) ) It does not seem affecting the search results most time, but I am not sure how to get rid of it, and no trace to locate the lock file indicated in the log file. Any help is greatly appreciated. The attached is the code to add a doc. -Xin public synchronized int addRecord(IndexDataSource dataSource, int recordId, List<LibraryField> libSchema, String indexDir) throws IndexException { IndexWriter writer = null; int totalIndexed =0; try { . writer = new IndexWriter(indexDir, getAnalyzer(), false); writer.setUseCompoundFile(isCompound()); writer.addDocument(doc); writer.optimize(); totalIndexed = writer.docCount(); } } catch (IOException ioe) { throw new IndexException(ioe.toString()); } finally { try { if (null != writer) { writer.close(); } } catch (IOException ioe) { throw new IndexException(ioe.toString()); } } return totalIndexed;