lucenenet-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Benjamin Novosel" <b.novo...@drachenfels.de>
Subject Lucene Index Writer with MultiThreads?
Date Wed, 19 Nov 2008 12:43:26 GMT
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


Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message