2017-10-10 112 views
0

我遇到了一個場景,我想索引存在於blob存儲中的所有文件。 但是,在場景中,如果在Blob中上載的文件受密碼保護,索引器將失敗,並且索引器現在無法索引其餘文件。Azure Blob索引器問題

[ 
    { 
     "key": null, 
     "errorMessage": "Error processing blob 'url' with content type ''. Status:422, error: " 
    } 
] 

有沒有辦法忽略密碼保護的文件或一種方式繼續即使在一些文件中的錯誤索引過程。

+0

你能分享你的索引器定義嗎? –

+0

'索引索引=新的索引(){ 名稱 = indexerName, 的datasourcename =名稱, TargetIndexName = INDEXNAME, 附表=新IndexingSchedule(){ 間隔 = System.TimeSpan.FromMinutes(Convert.ToDouble(ConfigurationManager中。 AppSettings [「indexrefreshtime」])) } };' – user1500960

+0

indexer.Parameters = new IndexingParameters()。ExcludeFileNameExtensions(ConfigurationManager.AppSettings [「filetoignore」] .Split(',')); indexer.FieldMappings = new List (); indexer.FieldMappings.Add(新Microsoft.Azure.Search.Models.FieldMapping() { SourceFieldName = 「metadata_storage_path」, MappingFunction = Microsoft.Azure.Search.Models.FieldMappingFunction.Base64Encode() }); – user1500960

回答

0

有沒有辦法忽略密碼保護的文件或辦法 繼續即使在一些 文件中的錯誤索引過程。

一種可能的方式做到這一點是由名字AzureSearch_Skip定義的BLOB元數據,並將其值設置爲true。在這種情況下,Azure搜索服務將忽略此Blob並移至列表中的下一個Blob。

您可以在這裏閱讀更多關於此:https://docs.microsoft.com/en-us/azure/search/search-howto-indexing-azure-blob-storage#controlling-which-parts-of-the-blob-are-indexed

+1

如果您想忽略一個或幾個已知的不良數據塊,這是一個很好的方法。要處理所有的blob,使用'failOnUnsupportedContentType'配置設置更好。 –

1

請參閱處理不支持的內容類型部分Controlling which blobs are indexed。使用failOnUnsupportedContentType配置設置:

PUT https://[service name].search.windows.net/indexers/[indexer name]?api-version=2016-09-01 
Content-Type: application/json 
api-key: [admin key] 

{ 
    ... other parts of indexer definition 
    "parameters" : { "configuration" : { "failOnUnsupportedContentType" : false } } 
} 
+0

我沒有像這樣設置參數,但似乎沒有工作。 indexer.Parameters = new IndexingParameters()。DoNotFailOnUnsupportedContentType(); 還有什麼我需要做的? – user1500960

+0

什麼是您的搜索服務名稱和索引器名稱?我可以看看你的索引器定義,以確保它實際上是更新的。 –

+0

我不確定我是否應該分享這些細節。 我正在使用.NET客戶端代碼創建索引器 indexer.Parameters = new IndexingParameters()。DoNotFailOnUnsupportedContentType(); //排除索引中的文件 indexer.Parameters = new IndexingParameters()。ExcludeFileNameExtensions(ConfigurationManager.AppSettings [「filetoignore」] .Split(',')); indexer.FieldMappings = new List (); – user1500960