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: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 


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

Reply via email to