azure - 是否可以在 azure 搜索中使用元数据作为自定义技能的输入?

标签 azure search metadata azure-cognitive-search

我几个月前开始使用 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/

相关文章:

search - 在搜索栏中搜索未知号码(谷歌,YouTube,…)

c - 在 C 中搜索整数数组中的最大数字

java - Hibernate - 检索所有表信息 - 列名、索引、长度并填充为表

c# - 您好,我正在尝试在 Azure 应用程序服务中运行 Web 作业,但它抛出与日期时间相关的错误

Azure Synapse 创建管道 Rest API

algorithm - 找到与两个字符串匹配的有效方法

python - 使用 PyDrive (Python) 访问文件夹、子文件夹和子文件

azure - 如何在内容文件夹中创建没有绝对路径的msdeploy包?

azure - 通过数据工厂使用逻辑应用程序的动态电子邮件附件

hadoop - 基于 Apache Atlas 和 Hive,元数据存储在哪里?在 Titan Graph Repository 中还是在 RDBMS with Hive 中?