I had this same problem a while back.  It should be resolved if you move
the writer = new IndexWriter(...) until after the reader.close().  I.e.,
complete all the deletions and close the reader before creating the
writer.

Chuck

> -----Original Message-----
> From: MATL (Mats Lindberg) [mailto:[EMAIL PROTECTED]
> Sent: Sunday, October 17, 2004 5:36 AM
> To: [EMAIL PROTECTED]
> Subject: index, reindexing problem
> 
> Hello.
> 
> I have a problem when reindexing some documents after an index has
been
> created, i get an error, the error is the following.
> caught a class java.io.IOException
> 
> with message: Lock obtain timed out:
>
[EMAIL PROTECTED]:\DOCUME~1\..........lucene-0b877c2d5472a608d6ec3ee6174018de-write
> .lock
>
<mailto:[EMAIL PROTECTED]:\DOCUME~1\..........lucene-0b877c2d5472a608d6ec3ee6174018
> de-write.lock>
> 
> 
> This is how i do it.
> 1.st make the index (_indexDir is the location of the index)
> writer = new IndexWriter(_indexDir, new StandardAnalyzer(), true);
> 
> ..... do the indexing here
> 
> writer.optimize();
> 
> writer.close();
> 
> this works fine
> 
> 
> 2. this is where i get the error (reindex an existing document)
> writer = new IndexWriter(_indexDir, new StandardAnalyzer(), false);
> Directory directory;
> 
> IndexReader reader;
> 
> // if the file is in the index already, remove it
> 
> directory = FSDirectory.getDirectory(_indexDir, false);
> 
> reader = IndexReader.open(directory);
> 
> try {
> 
> Term term = new Term("deleteid", deleteID.toLowerCase());
> 
> if (reader.docFreq(term) >= 1) {
> 
> deletedItems = reader.delete(term);// ----- this is where the error
> occurs, i get the locking error
> 
> }
> 
> } catch (Exception e) {
> 
> System.out.println(" caught a " + e.getClass() + "\n with message: " +
> e.getMessage());}
> 
> finally {
> 
> reader.close();
> 
> directory.close();
> 
> }
> 
> continue with reindexing the new document
> 
> ......
> 
> 
> 
> I hope anyone can help me with this problem.
> 
> 
> 
> Best regards,
> 
> Mats Lindberg
> 
> 


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

Reply via email to