【问题标题】:Indexing static HTML blob storage content with Azure Cognitive Search is not working as expected使用 Azure 认知搜索为静态 HTML blob 存储内容编制索引未按预期工作
【发布时间】:2020-04-25 05:54:55
【问题描述】:

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

我尝试了许多不同的索引器配置,但到目前为止还无法判断我是否有错误配置,或者 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
}

【问题讨论】:

    标签: azure search meta azure-cognitive-search


    【解决方案1】:

    这可能是由于您的索引器中的配置 "parsingMode": "文本"

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

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

    【讨论】:

    • 我没有尝试过的一件事,这成功了,谢谢!出于性能原因,我看到了几个使用“文本”的参考,但没有指出“默认”对于执行 HTML 转换是必要的。我们没有大量的文件,所以归根结底,性能不是问题。为了比较,更改导致索引所有文件所需的时间增加了 6 秒。我会接受的。
    猜你喜欢
    • 2018-10-17
    • 2016-12-02
    • 2016-11-13
    • 1970-01-01
    • 2020-06-17
    • 2019-03-30
    • 2021-04-14
    • 2021-12-11
    • 2018-04-30
    相关资源
    最近更新 更多