great seems to solve the problem
Mats
-----Oprindelig meddelelse-----
Fra: Chuck Williams [mailto:chuck@manawiz.com]
Sendt: 17. oktober 2004 19:21
Til: Lucene Users List
Emne: RE: index, reindexing problem
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:matl@nnit.com]
> Sent: Sunday, October 17, 2004 5:36 AM
> To: lucene-user@jakarta.apache.org
> 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:
>
Lock@C:\DOCUME~1\..........lucene-0b877c2d5472a608d6ec3ee6174018de-write
> .lock
>
<mailto:Lock@C:\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: 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
|