Thanks Digy, always helpful!

//Robert

On 2011/09/01/ 7:43 PM, Digy wrote:
Try a newer version of Lucene.Net.
http://incubator.apache.org/lucene.net/download.html

DIGY

-----Original Message-----
From: Robert Pohl [mailto:[email protected]]
Sent: Thursday, September 01, 2011 11:30 AM
To: [email protected]
Subject: [Lucene.Net] Locked File while adding doc to writer

Hi,

Suddenly i cannot add doc to the index (Lucene.Net 2.0.0.4), i get this
exception:

"{"Cannot rename
C:\\work\\Bokborgen\\Bokborgen\\Index_tmp\\deleteable.new to
C:\\work\\Bokborgen\\Bokborgen\\Index_tmp\\deletable"}"

Inner exception: "{"The process cannot access the file
'C:\\work\\Bokborgen\\Bokborgen\\Index_tmp\\deleteable.new' because it
is being used by another process."}"

  From my Google'ing this seems like a Windows locking problem.
I turned of system indexing in win, but it didn't help.

Do you guys know of a workaround?

My Code:
IndexWriter writer = new IndexWriter(dir, new StandardAnalyzer(), true);
...

var doc = new Document();
doc.Add(new Lucene.Net.Documents.Field("Id", p.Id.ToString(),
Field.Store.YES, Field.Index.UN_TOKENIZED));
doc.Add(new Field("ISBN", p.ExternalId, Field.Store.YES,
Field.Index.TOKENIZED));
doc.Add(new Field("Title", p.ProductName, Field.Store.YES,
Field.Index.TOKENIZED));
doc.Add(new Field("Category", catName, Field.Store.YES,
Field.Index.TOKENIZED));
doc.Add(new Field("Contributors", p.GetContributors(false),
Field.Store.YES, Field.Index.TOKENIZED));
doc.Add(new Field("BookType", p.BookType(), Field.Store.YES,
Field.Index.UN_TOKENIZED));
doc.Add(new Field("Description", p.DescriptionLong, Field.Store.YES,
Field.Index.TOKENIZED));

writer.AddDocument(doc);<-- error is here after a while

Thanks,
Robert



Reply via email to