【发布时间】:2017-10-31 10:19:11
【问题描述】:
我知道 blob 存储是(迄今为止)唯一支持 html 内容索引的数据源。
我的问题是,在通过 REST 将文档添加到索引之前,是否可以使用自定义分析器和 charfilter 'html_strip'(在 azure 文档中提到)去除内容?
这是我的创建索引负载:
{
"name": "htmlindex",
"fields": [
{"name": "id", "type": "Edm.String", "key": true, "searchable": false},
{"name": "title", "type": "Edm.String", "filterable": true, "sortable": true, "facetable": true},
{"name": "html", "type": "Collection(Edm.String)", "analyzer": "htmlAnalyzer"}
],
"analyzers": [
{
"name": "htmlAnalyzer",
"@odata.type": "#Microsoft.Azure.Search.CustomAnalyzer",
"charFilters": [ "html_strip" ],
"tokenizer": "standard_v2"
}
]
}
这是我将文档添加到索引有效负载:
{
"value": [
{
"id": "1",
"title": "title1",
"html": [
"<p>test1</p>",
"<p>test2</p>"
]
}
]
}
现在当我搜索索引时,我看到 html 内容没有被剥离:
{
"@odata.context": "https://deviqfy.search.windows.net/indexes('htmlindex')/$metadata#docs",
"value": [
{
"@search.score": 1,
"id": "1",
"title": "title1",
"html": [
"<p>test1</p>",
"<p>test2</p>"
]
}
]
}
我做错了什么?如何在添加之前完成从内容中剥离 html?没有预先步骤..
【问题讨论】:
标签: azure azure-cognitive-search