使用 Azure 认知搜索索引静态 HTML blob 存储内容未按预期工作

Indexing static HTML blob storage content with Azure Cognitive Search is not working as expected

我正在为 blob 存储中的静态 HTML 内容编制索引。该文档指出,预处理分析器在从该数据源索引内容时将去除周围的 HTML 标签。但是,我们的 content 值始终是整个原始 HTML 文档。我也无法提取 "meta description" 标签的值。根据索引 Blob 存储上的 documentation,HTML 内容应自动生成 metadata_description 属性,但该值始终为 null。

我已经尝试了许多不同的索引器配置,但到目前为止还无法判断我是否配置错误或者 Azure 搜索是否无法正确识别内容类型。

blob 存储中的所有文件都具有 .html 文件扩展名,内容类型 列显示 text/html.

这是索引器配置(一些位 ):

{
  "@odata.context": "https://<instance>.search.windows.net/$metadata#indexers/$entity",
  "@odata.etag": "\"<tag>\"",
  "name": "<name>",
  "description": null,
  "dataSourceName": "<datasource name>",
  "skillsetName": null,
  "targetIndexName": "<target index>",
  "disabled": null,
  "schedule": {
    "interval": "PT2H",
    "startTime": "0001-01-01T00:00:00Z"
  },
  "parameters": {
    "batchSize": null,
    "maxFailedItems": -1,
    "maxFailedItemsPerBatch": null,
    "base64EncodeKeys": null,
    "configuration": {
      "parsingMode": "text",
      "dataToExtract": "contentAndMetadata",
      "excludedFileNameExtensions": ".png .jpg .mpg .pdf",
      "indexedFileNameExtensions": ".html"
    }
  },
  "fieldMappings": [
    {
      "sourceFieldName": "metadata_storage_path",
      "targetFieldName": "id",
      "mappingFunction": {
        "name": "base64Encode",
        "parameters": null
      }
    },
    {
      "sourceFieldName": "metadata_description",
      "targetFieldName": "description",
      "mappingFunction": null
    },
    {
      "sourceFieldName": "metadata_storage_path",
      "targetFieldName": "url",
      "mappingFunction": {
        "name": "extractTokenAtPosition",
        "parameters": {
          "delimiter": "<delimiter>",
          "position": 1
        }
      }
    }
  ],
  "outputFieldMappings": [],
  "cache": null
}

这可能是由于您的索引器中的配置所致 "parsingMode": "text"

此解析模式用于从文档中提取文字文本值。在这种情况下,这包括所有 html 标签。

将该配置更改为 "parsingMode":"default" 从文档中删除 html 标签。