You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Azure Search索引Azure Files中ZIP内文本的问题咨询

Azure Search 索引Azure Files中ZIP归档内文本文件的问题解决

问题1:ZIP归档内文本无法提取,content字段存整个ZIP文件

Azure Search 默认不会自动解析ZIP归档并提取内部文件内容,你需要在索引器配置中添加归档解析参数,同时确保索引包含content字段(不需要改成复杂类型,用Edm.String即可)。

具体操作要点:

  • 索引里要新增content字段,类型设为Edm.String,并开启searchable属性,用于存储提取出的文本内容
  • 索引器配置的configuration中添加parsingMode: "default",该模式支持自动识别并解析ZIP、GZIP等归档文件,将内部文件作为独立文档处理

问题2:移除content字段后仍遇文档大小超限

即使移除了content字段,索引器处理ZIP文件时仍会尝试提取整个文件内容进行解析,这就触发了Basic SKU的16MB文档大小限制。推荐两种解决方式:

  1. 在索引器的configuration中添加indexStorageMetadataOnlyForOversizedDocuments: true,让超大文件仅索引元数据,跳过内容提取
  2. 配置索引器只解析归档内的目标文件,避免将ZIP本身作为文档处理(更贴合你的需求,因为核心目标是索引归档内的文本)

修改后的配置示例

索引配置(新增content字段)

{
  "name" : "zipindex",
  "fields": [
      { "name": "ID", "type": "Edm.String", "key": true, "searchable": false },
      { "name": "metadata_storage_name", "type": "Edm.String", "searchable": false, "filterable": true, "sortable": true  },
      { "name": "metadata_storage_path", "type": "Edm.String", "searchable": false, "filterable": true, "sortable": true },
      { "name": "metadata_storage_size", "type": "Edm.Int64", "searchable": false, "filterable": true, "sortable": true  },
      { "name": "metadata_storage_content_type", "type": "Edm.String", "searchable": true, "filterable": true, "sortable": true },
      { "name": "content", "type": "Edm.String", "searchable": true, "filterable": false, "sortable": false }     
  ]
}

索引器配置(添加归档解析和超限处理)

{
  "name" : "zipindexer",
  "dataSourceName" : "datasource",
  "targetIndexName" : "zipindex",
  "parameters": {
     "batchSize": null,
     "maxFailedItems": null,
     "maxFailedItemsPerBatch": null,
     "base64EncodeKeys": null,
     "configuration": {
        "indexedFileNameExtensions" : ".txt,.ini,.vzg",
        "excludedFileNameExtensions" : ".png,.jpeg,.dat,.img",
        "parsingMode": "default",
        "indexStorageMetadataOnlyForOversizedDocuments": true
    }
  },
  "schedule" : { },
  "fieldMappings" : [ ]
}

额外说明

  • parsingMode: "default"会让索引器自动识别归档文件,将内部每个文件作为独立文档索引,同时保留ZIP本身的元数据
  • 如果不需要保留ZIP文件的元数据,可以在数据源配置中添加excludedFileNameExtensions: ".zip",直接跳过ZIP文件本身的索引

内容的提问来源于stack exchange,提问作者PatrickT

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.21 03:48:35