定義投影

已完成

在知識存放區中儲存的資料投影是根據您在編製索引過程中,由擴充管道所產生的文件結構。 您技能組中的每一項技能會針對所編製索引的文件,以反復的方式建立擴充資料的 JSON 表示法,而您可以將文件的部分或全部欄位保存為投影。

使用塑形器技能

以累加方式編製索引的程式會建立出複雜的文件,其中包含技能組中各項技能的各種輸出欄位。 這可能會導致難以使用的架構,其中包含無法輕易對應至格式正確的 JSON 的基本數據值集合。

為了簡化這些域值與知識存放區中投影的對應,通常會使用 Shaper 技能來建立新的欄位,其中包含您想要對應至投影之字段的更簡單結構。

例如,請考慮下列 Shaper 技能定義:

{
  "@odata.type": "#Microsoft.Skills.Util.ShaperSkill",
  "name": "define-projection",
  "description": "Prepare projection fields",
  "context": "/document",
  "inputs": [
    {
      "name": "file_name",
      "source": "/document/metadata_content_name"
    },
    {
      "name": "url",
      "source": "/document/url"
    },
    {
      "name": "sentiment",
      "source": "/document/sentimentScore"
    },
    {
      "name": "key_phrases",
      "source": null,
      "sourceContext": "/document/merged_content/keyphrases/*",
      "inputs": [
        {
          "name": "phrase",
          "source": "/document/merged_content/keyphrases/*"
        }
      ]
    }
  ],
  "outputs": [
    {
      "name": "output",
      "targetName": "projection"
    }
  ]
}

此 Shaper 技能會建立具有下列結構的 投影 欄位:

{
    "file_name": "file_name.pdf",
    "url": "https://<storage_path>/file_name.pdf",
    "sentiment": 1.0,
    "key_phrases": [
        {
            "phrase": "first key phrase"
        },
        {
            "phrase": "second key phrase"
        },
        {
            "phrase": "third key phrase"
        },
        ...
    ]
}

產生的 JSON 檔案格式正確,與先前在擴充管道中以反復方式建立的較複雜文件比較,更容易對應到知識存放區中的投影。