【问题标题】:Azure search complex struct sql datasourceAzure 搜索复杂结构 sql 数据源
【发布时间】:2020-01-18 10:04:15
【问题描述】:

azure 搜索的复杂 json 结果的 sql 数据源是什么?

Azure 搜索索引可以连接到 sql server 的单个表/视图。因此,如果我有复杂的 json,数据源表/视图会是什么样子?

例如,如果生成的 json 是这样的:

{
  "HotelId": "1",
  "HotelName": "Secret Point Motel",
  "Description": "Ideally located on the main commercial artery of the city in the heart of New York.",
  "Address": {
    "StreetAddress": "677 5th Ave",
    "City": "New York",
    "StateProvince": "NY"
  },
  "Rooms": [
    {
      "Description": "Budget Room, 1 Queen Bed (Cityside)",
      "Type": "Budget Room",
      "BaseRate": 96.99
    },
    {
      "Description": "Deluxe Room, 2 Double Beds (City View)",
      "Type": "Deluxe Room",
      "BaseRate": 150.99
    },
  ]
}

对应的sql数据源是什么?

【问题讨论】:

  • 这个 JSON 是如何存储在您的 SQL 表/视图中的?这是特定列的值还是整行?
  • 这没有存储在我的表中。我想知道它如何与 SQL 作为数据源一起使用
  • 你会认为 json 结果是这样的吗: { "hotelid": 1, "name": "hotel1", "hoteldetails": [{ "hc": "city1", "hs": " st1”,“房间”:[{“type”:“type1”,“description”:“desc1”},{“type”:“type2”,“description”:“desc2”},{“type”:“ type3", "description": "desc3" } ] } ] }
  • 是的,这对我有用。它对应的 sql 数据源是什么?

标签: azure-cognitive-search azure-search-.net-sdk


【解决方案1】:

查看下面示例中的“Rooms”字段,您似乎想将源 SQL 表中的几行合并到单个 Azure 搜索文档中的数组字段中——不幸的是,将多行合并到不支持文档的单个字段。

对于其他字段,例如“地址”,您似乎希望将几列(同一行的)合并到一个字段中,这可以使用Shaper skill

我希望这会有所帮助。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多