【问题标题】:How to Index child object properties and writing search queries in YDN DB from JSON file data如何从 JSON 文件数据索引子对象属性并在 YDN DB 中编写搜索查询
【发布时间】:2017-02-04 19:20:30
【问题描述】:

我浏览了很多网站,但找不到任何解决方案。这是我的问题。我想索引 YDN DB 中的子属性和父属性。

我的 JSON 数据示例:

"dataList":[            
    {   
        "id":1,
        "code":"TN",
        "name":"TestName",
        "city":{
            "cityCode":"ABC",
            "cityName":"ABC City"
        },"country":{
            "countryCode":"NG",
            "countryName":"Nigeria"
        },
        "isOnline":true             
    } 
]

YDB 架构和存储:

"schema": 
{
  "stores": 
  [    
    {
      "name": "airlineList",
      "keyPath": "airportName",
        "indexes": [
        {
          "keyPath": "airportCode"
        },
        {
          "keyPath": "cityCode"
        }
      ]
    }
  ]
}

当我尝试索引无法过滤的子对象(城市)属性时,我正在尝试通过索引父属性和子属性将 JSON 数据存储到索引数据库中。

提前致谢

【问题讨论】:

    标签: ydn-db ydn-db-fulltext


    【解决方案1】:

    您可以使用keyPath as an array,例如['city', 'cityCode']

    【讨论】:

      猜你喜欢
      • 2014-04-29
      • 1970-01-01
      • 2015-02-14
      • 2013-12-01
      • 1970-01-01
      • 1970-01-01
      • 2018-12-21
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多