【问题标题】:Issue with Azure Blob IndexerAzure Blob 索引器问题
【发布时间】:2017-10-10 22:05:10
【问题描述】:

我遇到了一个场景,我想索引 Blob 存储中存在的所有文件。 但是,如果在 Blob 中上传的文件受密码保护,则索引器会失败,并且索引器现在无法索引剩余的文件。

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

有没有办法忽略受密码保护的文件,或者即使某些文件出现错误也可以继续索引过程。

【问题讨论】:

  • 你能分享你的索引器定义吗?
  • ` Indexer indexer = new Indexer() { Name = indexerName, DataSourceName = name, TargetIndexName = indexName, Schedule = new IndexingSchedule() { Interval = System.TimeSpan.FromMinutes(Convert.ToDouble(ConfigurationManager. AppSettings["indexrefreshtime"])) } };`
  • indexer.Parameters = new IndexingParameters().ExcludeFileNameExtensions(ConfigurationManager.AppSettings["filetoignore"].Split(',')); indexer.FieldMappings = new List(); indexer.FieldMappings.Add(new Microsoft.Azure.Search.Models.FieldMapping() { SourceFieldName = "metadata_storage_path", MappingFunction = Microsoft.Azure.Search.Models.FieldMappingFunction.Base64Encode() });
  • 请不要将这些包含在 cmets 中。而是编辑您的问题并在其中包含代码。
  • 我猜问题是上传的文件受密码保护,因此索引器失败,但它不会继续索引其他文件

标签: azure azure-cognitive-search azure-blob-storage


【解决方案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 } }
}

【讨论】:

  • 我确实设置了这样的参数,但似乎没有工作。 indexer.Parameters = new IndexingParameters().DoNotFailOnUnsupportedContentType();还有什么我需要做的吗?
  • 您的搜索服务名称和索引器名称是什么?我可以查看您的索引器定义以确保它确实已更新。
  • 我不确定是否应该分享这些细节。我正在使用 .NET 客户端代码创建索引器 indexer.Parameters = new IndexingParameters().DoNotFailOnUnsupportedContentType(); // 从索引中排除文件 indexer.Parameters = new IndexingParameters().ExcludeFileNameExtensions(ConfigurationManager.AppSettings["filetoignore"].Split(',')); indexer.FieldMappings = new List();
  • 但是您是否正在调用更新您的索引器定义?您可以将详细信息通过电子邮件发送给我,而不是在此处发布:eugenesh 在通常的 Microsoft 域中。
  • 我的代码基本上删除了现有的索引器,然后创建一个新的。
【解决方案2】:

有没有办法忽略受密码保护的文件或 即使在某些地方有错误,也继续索引过程 文件。

一种可能的方法是在 blob 上定义一个名为 AzureSearch_Skip 的元数据,并将其值设置为 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

【讨论】:

  • 如果您想忽略一个或几个已知的坏 blob,这是一个好方法。要处理所有 blob,使用failOnUnsupportedContentType 配置设置更好。
猜你喜欢
  • 2019-02-05
  • 1970-01-01
  • 2018-02-09
  • 2017-04-18
  • 1970-01-01
  • 2017-09-22
  • 2020-03-03
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多