This hapened only on Windows, on Ubuntu it don't happen. And I corrected this problem by removing the commit, and put it in the end of the addition of all documents.
On Fri, Nov 20, 2009 at 9:14 PM, Erick Erickson <erickerick...@gmail.com>wrote: > What operating system are you running on? This sounds like Windows behavior > when some other process is holding the file open..... > > Erick > > 2009/11/20 Fabrício Raphael <fabricio...@gmail.com> > > > Hi, > > > > I am evaluating several search algoritms, and I iterate on each. In each > > interation I delete the index directory, index the docs and I run the > > evaluation on the algoritm. The end of the iteration I close the > > indexReader. > > > > Then, in the second iteration the following error occurs int the doc 1154 > > indexing: > > > > adding docs\1148 > > adding docs\1149 > > adding docs\1150 > > adding docs\1151 > > adding docs\1152 > > adding docs\1153 > > adding docs\1154 > > java.io.IOException: Cannot overwrite: index\_zk.cfs > > at > org.apache.lucene.store.FSDirectory.initOutput(FSDirectory.java:362) > > at > > > > > org.apache.lucene.store.SimpleFSDirectory.createOutput(SimpleFSDirectory.java:58) > > at > > > > > org.apache.lucene.index.CompoundFileWriter.close(CompoundFileWriter.java:150) > > at > > > > > org.apache.lucene.index.DocumentsWriter.createCompoundFile(DocumentsWriter.java:618) > > at > > > org.apache.lucene.index.IndexWriter.doFlushInternal(IndexWriter.java:4320) > > at org.apache.lucene.index.IndexWriter.doFlush(IndexWriter.java:4174) > > at org.apache.lucene.index.IndexWriter.flush(IndexWriter.java:4165) > > at > > org.apache.lucene.index.IndexWriter.prepareCommit(IndexWriter.java:4055) > > at org.apache.lucene.index.IndexWriter.commit(IndexWriter.java:4118) > > at org.apache.lucene.index.IndexWriter.commit(IndexWriter.java:4096) > > > > This is the code: > > > > public void addDocument(Document doc) throws CorruptIndexException, > > IOException { > > synchronized (getIndexWriter()) { > > getIndexWriter().addDocument(doc); > > getIndexWriter().commit(); > > } > > } > > > > > > Can any help me? > > > > Now Thanks! > > > > -- > > Fabrício Raphael Silva Ferreira > > > -- Fabrício Raphael