简体   繁体   中英

No accessible 'New' accepts this number of arguments

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

using this code got an error

" No accessible 'New' accepts this number of arguments."

help me to solve this

这可能对您有用:

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM