Hi,

 

I'm using Lucene.net 2.0.0 and my index file is on shared directory.

 

All was working fine but today two users add a document at the same time.

Now when I try to search or add a document to the index I'm getting the
following error: "cannot find file _ov0.fnm".

 

How can I save my index? 

 

Maybe I'm doing something wrong in my code; do I have to put a lock when I
add a document to the index (as my index is on a shared directory)?

 

 

Dim writer As IndexWriter

Dim champ As Field

 

Try

writer = New IndexWriter(REPERTOIRE_INDEX_FULLTEXT, New
Standard.StandardAnalyzer(), False)

 

      Dim leDocument As Document = New Document()

 

      leDocument.Add(New Field("re_id", dossier.entite.getID,
Field.Store.YES, Field.Index.NO))

      leDocument.Add(New Field("rp_td_id", CStr(dossier.typedoc.rp_td_id),
Field.Store.YES, Field.Index.NO))

      leDocument.Add(New Field("contenu", contenuDocument, Field.Store.YES,
Field.Index.TOKENIZED))

 

      Try

      writer.AddDocument(leDocument)

            '' at least on windows, some temporary files raise this
exception with an "access denied" message

            '' checking if the file can be read doesn't help

            Catch ex As FileNotFoundException

 

      End Try

      

writer.Optimize()

      writer.Close()

 

     Catch ex As IOException

         The error occurs here ------ >   MessageBox.Show("L'index Fulltext
n'existe pas ou est corrompu. Reconstruisez l'index. " + ex.Message, "Erreur
index", MessageBoxButtons.OK, MessageBoxIcon.Error)

            Return False

        Catch ex As Exception

MessageBox.Show("Erreur lors de l'indexation du document car : " +
ex.Message, "Insertion impossible", MessageBoxButtons.OK,
MessageBoxIcon.Error)

            End If

            Return False

        End Try

 

 

 

Thanks for your help,

Nicolas

 

Reply via email to