【发布时间】:2019-11-28 21:51:37
【问题描述】:
我是 Azure 搜索的新手,我目前正在设置一个环境来根据某些详细信息对图像进行索引。
我建立了一个索引,其中包含我命名为details 的复杂字段的集合。
为了填充details 字段,我在索引器上设置了一个Azure 函数作为WebApiSkill,它接收uri 作为输入并返回details。
According to the example from the documentation,函数接收application/jsonPOST请求如下:
{
"values": [
{
"recordId": "1",
"data": {
"uri": "..."
}
},
...
]
}
..并立即返回 OkObjectResult 和相应的 json 响应:
{
"values": [
{
"recordId": "1",
"data": {
"details": [
{
"detailName": "...",
"detailRatio": "..."
}, {
"detailName": "...",
"detailRatio": "..."
}
]
}
},
...
]
}
我的问题是,即使我遵循了有关如何为索引员的技能设置自定义技能的文档,并且即使上述所有内容看起来结构正确,我索引图像上的 details 仍然没有填充,它只是显示为空列表。
以下是对我的索引进行空搜索的结果:
{
"@odata.context": "https://{search}.search.windows.net/indexes('{index}')/$metadata#docs(*)",
"value": [
{
"@search.score": 1,
"id": "aHR0CHM6Ly9yZWxhdGl...",
"uri": "{link}",
"details": []
}
}
通过控制台日志跟踪 Azure Function 的执行情况,可以看到索引器确实在执行它并接收结果,所以我认为这不是连接问题或函数代码的问题。
我想知道这是否经常发生?如果没有,我应该采取哪些步骤来尝试找出索引器拒绝正确填充索引的原因?
这是我的索引/索引器/技能集中的一些代码 sn-ps。 对于此处的任何混淆,我深表歉意,因为其中一些必须通过代码 (C#) 进行,而另一些必须在 Azure 门户中或通过 POST 请求进行。据我所知,所有这些都归结为相同,但我目前正在将所有这些转换为 POST 请求。
索引:
{
"id": "...",
"uri": "...",
"details": [
{
"detailName": "...",
"detailRatio": "..."
}, {
"detailName": "...",
"detailRatio": "..."
}
]
}
技能组:
{
"name": "...",
"description": "...",
"skills":
[
{
"@odata.type": "#Microsoft.Skills.Custom.WebApiSkill",
"uri": "https://{azure-function}.azurewebsites.net/api/{function}?code={code}",
"context": "/document",
"inputs": [
{
"name": "uri",
"source": "/document/uri"
}
],
"outputs": [
{
"name": "details",
"targetName": "details"
}
]
}
]
}
索引器:
new Indexer(
name: indexerName,
dataSourceName: dataSourceName,
targetIndexName: indexName,
skillsetName: skillsetName,
fieldMappings: new List<FieldMapping>
{
new FieldMapping
{
SourceFieldName = "metadata_storage_path",
TargetFieldName = "uri"
}
},
schedule: new IndexingSchedule {
Interval = new TimeSpan(0, 10, 0)
},
parameters: new IndexingParameters
{
Configuration = new Dictionary<string, object>
{
["imageAction"] = "generateNormalizedImages"
}
}
);
【问题讨论】:
标签: azure azure-functions azure-blob-storage azure-cognitive-search