我几个月前开始使用 Azure 搜索,但我对 blob 文件的元数据有疑问。
我需要文件的元数据(来自 Azure Blob)才能在我的 Customskill 中使用它。 (更具体地说,我需要存储 blob 文件的 URL)。
为了做到这一点,我需要在我的技能中使用它,我会做类似this image中的事情。但这是不可能的,因为源必须以/document 开头?如果我将“/document/metadata_storage_path/”作为“Source”,我最终会得到一个空值吗?
有没有办法获取文件的元数据作为输入以进一步使用它?
提前致谢!
最佳答案
我发现了为什么它(和解决方案)对我不起作用。我希望我可以帮助其他遇到此问题的人。
Sophiac 上面提到的语法是正确的。因此,就我而言,我使用“metadata_storage_path”作为技能组中的输入:
{
"@odata.type": "#Microsoft.Skills.Custom.WebApiSkill",
"description": "Our new substring custom skill",
"uri": "https://customskillsubstring.azurewebsites.net/api/Translate?code=OkzL7G3wX----jCqQylUyJJPaggSaFQCaQ==",
"batchSize":1,
"context": "/document",
"inputs": [
{
"name": "text", "source": "/document/metadata_storage_path"
}
],
"outputs": [
{
"name": "text",
"targetName": "metadata_storage_path_wathever"
}
]
}
问题出在索引器中。我在字段中将“metadata_storage_path”映射到其他内容(在我的例子中为“blob_uri”)。问题是这并不是真正的映射,而更像是替代。因此,技能集中的“metadata_storage_path”为空,因为它已被替换。
但是如果我使用“blob_uri”它就可以工作。 解决方案是您可以将一个输入映射到索引器中的多个事物:
"fieldMappings" : [
{
"sourceFieldName" : "metadata_storage_name",
"targetFieldName" : "id",
"mappingFunction" :
{ "name" : "base64Encode" }
},
{
"sourceFieldName" : "content",
"targetFieldName" : "content"
},
{
"sourceFieldName" : "metadata_storage_path",
"targetFieldName" : "blob_uri"
},
{
"sourceFieldName" : "metadata_storage_path",
"targetFieldName" : "metadata_storage_path"
}
],
现在我可以使用“blob_uri”和“metadata_storage_path”作为我的customkill 的输入。
关于azure - 是否可以在 azure 搜索中使用元数据作为自定义技能的输入?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54042074/