lucenenet-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Digy" <digyd...@gmail.com>
Subject RE: [Lucene.Net] Locked File while adding doc to writer
Date Thu, 01 Sep 2011 17:43:21 GMT
Try a newer version of Lucene.Net.
http://incubator.apache.org/lucene.net/download.html

DIGY

-----Original Message-----
From: Robert Pohl [mailto:robban.p@gmail.com] 
Sent: Thursday, September 01, 2011 11:30 AM
To: lucene-net-user@lucene.apache.org
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



Mime
View raw message