Sub CreatePersonsIndex(ByVal dt As System.Data.DataTable)
Try
'Specify the index file location where the indexes are to be stored
Dim indexFileLocation As String = "C:\Users\Shahrukh\Documents\visual studio 2012\Projects\WpfApplication33\WpfApplication33\App_Data"
Dim dir As Lucene.Net.Store.Directory = Lucene.Net.Store.FSDirectory.GetDirectory(indexFileLocation, True)
Dim indexWriter As New IndexWriter(dir, New StandardAnalyzer(), True)
indexWriter.SetRAMBufferSizeMB(10.0)
indexWriter.SetUseCompoundFile(False)
indexWriter.SetMaxMergeDocs(10000)
indexWriter.SetMergeFactor(100)
If dt IsNot Nothing Then
If dt.Rows.Count > 0 Then
For Each dr As System.Data.DataRow In dt.Rows
'Create the Document object
Dim doc As New Document()
For Each dc As System.Data.DataColumn In dt.Columns
'Populate the document with the column name and value from our query
doc.Add(New Field(dc.ColumnName, dr(dc.ColumnName).ToString(), Field.Store.YES, Field.Index.TOKENIZED))
Next
' Write the Document to the catalog
indexWriter.AddDocument(doc)
Next
End If
End If
' Close the writer
indexWriter.Close()
Catch ex As Exception
MsgBox("Error")
End Try
End Sub
使用此代码时出现错误
“不可访问'新'接受这个数量的论点。”
帮我解决这个问题