Azure Blob索引器问题

问题描述:

我遇到了一个场景,我想索引存在于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

有没有办法忽略密码保护的文件或办法 继续即使在一些 文件中的错误索引过程。

一种可能的方式做到这一点是由名字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'配置设置更好。 –

请参阅处理不支持的内容类型部分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