几个月前,我开始使用Azure搜索,但是我对blobfiles的元数据有一个问题。
我需要文件的元数据(来自Azure Blob)在我的自定义技能中使用它。(更具体地说,我需要存储它的need文件的URL )。
要做到这一点,我需要在我的技能集,我会做一些类似于在这幅图像。但这是不可能的,因为源必须从/document开始吗?如果我将“/document/metadata_path/”作为"Source“,那么最终得到的值是空值吗?
是否有一种方法可以将文件的元数据作为输入来进一步使用它?
提前感谢!
发布于 2019-02-07 09:46:29
我发现了为什么它(以及解决方案)不适合我。我希望我能帮助其他遇到这个问题的人。
索菲亚克上面提到的语法是正确的。因此,在我的例子中,我使用"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”作为自定义技能的输入。
发布于 2019-01-08 22:25:17
我认为您的源路径必须是“/document/元数据存储_路径”,而不需要末尾的"/“。使用额外的"/",源路径被解释为metadata_storage_path中的一个目录,其名称为"“(空字符串)。
https://stackoverflow.com/questions/54042074
复制相似问题