我已经将.Net 4.0的大型应用程序更新为.Net 4.52,它已经破坏了我使用Lucene的一些索引和搜索功能。我更新到最新的Lucene NuGet包,我不断收到以下错误。 未定义类型“Lucene.Net.Index.IndexWriter”。 未定义类型“Lucene.Net.Documents.Document”。 未定义类型“IndexWriter”。 仅举几例。搜索功能最初是由另一个开发人员编写的,所以我并不完全熟悉它,但看起来他们在将Lucene更新到3.0.3时可能已经移动了一些命名空间,但我找不到他们更新的内容。 任何帮助将不胜感激! 谢谢 代码示例如下 参考文献:
Imports Microsoft.WindowsAzure.Storage.Blob
Imports Microsoft.WindowsAzure.Storage
Imports Lucene.Net
Imports Lucene.Net.Documents
Imports Lucene.Net.Store
Imports Lucene.Net.Index
Imports Lucene.Net.Analysis
Lucene.Net.Store表示它不包含任何公共成员。
未定义Lucene.Net.Index.IndexWriter的示例函数
Private Function IndexNewDocument(id As String, savePath As String, targetContainer As String, indexer As Lucene.Net.Index.IndexWriter, b As CloudBlockBlob) As Boolean
Dim sw As Stopwatch = Stopwatch.StartNew
Dim filename As String = ""
Dim dt As DateTime = Now
Try
' Retrieve the document and pull the metadata for reindexing
Dim docReturn As DocumentReturn = DocumentDownloadAdapter.GetDocument(_StorageEndpoint, _NewDocumentContainerName, id)
filename = docReturn.Filename
dt = docReturn.DateAdded
' Get the blob reader for indexing
Dim docReader As IBlobDocumentReader = FileProcessor.GetBlobDocumentReader(docReturn.FileBytes, docReturn.Filename, savePath)
' push the index to the blob storage database
pushIndexDocument(id, filename, dt, docReader, indexer)
sw.Stop()
OnDocumentIndexSuccessful(id, filename, sw.Elapsed)
Return True
Catch ex As EmptyPDFException
CommonCodeLib.ErrorReport("AzureStorageAccountAdapter.indexDocument", ex, "")
' DELETE FILE FROM NEW BLOB INDEX
Try
b.Delete()
Catch exDelete As Exception
CommonCodeLib.ErrorReport("AzureStorageAccountAdapter.indexDocument: Problem Deleting blob", exDelete, "")
End Try
Try
Dim username As String = getDocumentUsername(targetContainer, id)
EmailAdapter.SendExceptionEmail(ex, GetEmailList(ConfigurationHelper.IndexEmailToList), GetEmailList(ConfigurationHelper.IndexEmailCCList), username)
Catch exEmail As Exception
CommonCodeLib.ErrorReport("AzureStorageAccountAdapter.indexDocument: Problem Emailing Exception", exEmail, "")
End Try
Return False
Catch ex As InvalidDocumentTypeException
CommonCodeLib.ErrorReport("AzureStorageAccountAdapter.indexDocument", ex, "")
' DELETE FILE FROM NEW BLOB INDEX
Try
b.Delete()
Catch exDelete As Exception
CommonCodeLib.ErrorReport("AzureStorageAccountAdapter.indexDocument: Problem Deleting blob", exDelete, "")
End Try
Try
Dim username As String = getDocumentUsername(targetContainer, id)
EmailAdapter.SendExceptionEmail(ex, GetEmailList(ConfigurationHelper.IndexEmailToList), GetEmailList(ConfigurationHelper.IndexEmailCCList), username)
Catch exEmail As Exception
CommonCodeLib.ErrorReport("AzureStorageAccountAdapter.indexDocument: Problem Emailing Exception", exEmail, "")
End Try
Return False
Catch ex As Exception
CommonCodeLib.ErrorReport("AzureStorageAccountAdapter.indexDocument", ex.ToString, "")
sw.Stop()
OnDocumentIndexFailed(id, filename, sw.Elapsed, ex)
Return False
End Try
End Function