You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@lucene.apache.org by Sebastian Ho <se...@bii.a-star.edu.sg> on 2004/05/31 12:02:31 UTC

indexreader throwing IOException with lock obtain timed out

hi

i am updating the index and therefore need to delete documents before
adding the updated version.

This is how I delete the document which is working fine.

-----------------------------------------------------------------
int deleteDoc = 0;
deleteDoc = IndexReader.open(dstDir).delete(new Term("url", url));
IndexReader.open(dstDir).close();
-----------------------------------------------------------------

The writer after that throws an IOException : Lock obtain timed out.

-----------------------------------------------------------------
Analyzer analyzer = new StandardAnalyzer();
IndexWriter writer = new IndexWriter(dstDir, analyzer, overwrite);
-----------------------------------------------------------------

Am I missing anything? I have already closed the IndexReader before
calling the writer.

Thanks


Sebastian 




---------------------------------------------------------------------
To unsubscribe, e-mail: lucene-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: lucene-user-help@jakarta.apache.org


Re: indexreader throwing IOException with lock obtain timed out

Posted by Sebastian Ho <se...@bii.a-star.edu.sg>.
Sorry guys I have solved it. I should do this.

int deleteDoc = 0;
IndexReader reader = IndexReader.open(dstDir);
deleteDoc = reader.delete(new Term("url", url));
reader.close();

Just need to use the same instance of reader.

anyway lucene should just overwrite the old document during updating
instead..

sebastian

On Mon, 2004-05-31 at 18:02, Sebastian Ho wrote:
> hi
> 
> i am updating the index and therefore need to delete documents before
> adding the updated version.
> 
> This is how I delete the document which is working fine.
> 
> -----------------------------------------------------------------
> int deleteDoc = 0;
> deleteDoc = IndexReader.open(dstDir).delete(new Term("url", url));
> IndexReader.open(dstDir).close();
> -----------------------------------------------------------------
> 
> The writer after that throws an IOException : Lock obtain timed out.
> 
> -----------------------------------------------------------------
> Analyzer analyzer = new StandardAnalyzer();
> IndexWriter writer = new IndexWriter(dstDir, analyzer, overwrite);
> -----------------------------------------------------------------
> 
> Am I missing anything? I have already closed the IndexReader before
> calling the writer.
> 
> Thanks
> 
> 
> Sebastian 
> 
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: lucene-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: lucene-user-help@jakarta.apache.org
> 
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: lucene-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: lucene-user-help@jakarta.apache.org