azure - 使用 Azure 认知搜索为静态 HTML blob 存储内容编制索引未按预期工作
问题描述
我正在对 blob 存储中的静态 HTML 内容进行索引。该文档指出,在从该数据源索引内容时,预处理分析器将去除周围的 HTML 标记。但是,我们的content
值始终是整个原始 HTML 文档。我也无法提取我们的“元描述”标签的价值。根据Indexing Blob Storage 上的文档metadata_description
,HTML 内容应自动生成一个属性,但该值始终为 null。
我尝试了许多不同的索引器配置,但到目前为止还无法判断我是否有错误配置,或者 Azure 搜索是否无法正确识别内容类型。
Blob 存储中的所有文件都有一个.html
文件扩展名,并且内容类型列显示text/html
.
这是索引器配置(一些位 <redacted>):
{
"@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 标记。
推荐阅读
- java - Jitpack 不使用 maven 下载库源
- c# - Xamarin 将字符串数组绑定到 BindableLayout 仅在 Xaml 热重载后有效
- google-apps-script - 从 onSelectionChange 触发器显示侧边栏不起作用
- java - 如何更正 File .exists() 方法
- node.js - 在 gatsby-node.js 中多次查询 createPages 时出错
- fonts - wxStyledTextCtrl / wxwidgets中的字体质量/缩放(DPI)
- c++ - 如何提高 C++ 中默克尔根计算的速度?
- c - 如何显示存储在数组中的所有元素?
- python - 为什么我的 if 语句评估不正确?
- graphql - graphiQL 未显示 GraphQL schmea (spring graphql-spqr)