lucenenet-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Robert Pohl <robba...@gmail.com>
Subject [Lucene.Net] Locked File while adding doc to writer
Date Thu, 01 Sep 2011 08:30:14 GMT
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
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message