You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucenenet.apache.org by Benjamin Novosel <b....@drachenfels.de> on 2008/11/19 13:43:26 UTC
Lucene Index Writer with MultiThreads?
Hello,
i use Lucene.NET for my VB.NET Project.
I want to use Lucene.NET Index Writer at multi Threads.
The Problem is, if i use more than 1 Thread, it except an I/O Error (File already in use)
I Create a Thread and send Dir R as an Event!
Dim dirR As Lucene.Net.Store.RAMDirectory = New Lucene.Net.Store.RAMDirectory()
RaiseEvent SendIndex(dirR)
And here in the Event in the MainClass, it causes the Error on:
IW.AddIndexes(New Lucene.Net.Store.Directory() {DirR})
Public Sub NTSendIndex(ByVal DirR As Lucene.Net.Store.RAMDirectory)
Dim indexFileLocation As String = "index"
Dim dir As Lucene.Net.Store.FSDirectory = Lucene.Net.Store.FSDirectory.GetDirectory(indexFileLocation, True)
Dim analyzer As Lucene.Net.Analysis.Analyzer = New Lucene.Net.Analysis.Standard.StandardAnalyzer
Dim IW As Lucene.Net.Index.IndexWriter = New Lucene.Net.Index.IndexWriter(dir, analyzer, True)
IW.SetWriteLockTimeout(1000)
IW.AddIndexes(New Lucene.Net.Store.Directory() {DirR})
IW.Optimize()
IW.Close()
End Sub
Mit freundlichen Grüßen / Best regards
Novo