没有可访问的“新”接受这个数量的参数

时间:2015-09-13 06:16:28

标签: vb.net lucene.net

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

使用此代码时出现错误

  

“不可访问'新'接受这个数量的论点。”

帮我解决这个问题

1 个答案:

答案 0 :(得分:0)

这可能对您有用:Classes