因此,我使用Javascript和JSON来试图从JSON转储中检索信息。我对JavaScript的使用经验非常有限,但我很好奇如何用这些给定的查询来过滤结果(从IBM Watson的发现演示中查询和响应)。从多条件的Json转储中获取信息
查询
{
"count": 5,
"return": "title,enrichedTitle.text,url,host,blekko.chrondate",
"query": "\"uci\",language:english",
"aggregations": [
"nested(enrichedTitle.entities).filter(enrichedTitle.entities.type:Company).term(enrichedTitle.entities.text)",
"nested(enrichedTitle.entities).filter(enrichedTitle.entities.type:Person).term(enrichedTitle.entities.text)",
"term(enrichedTitle.concepts.text)",
"term(blekko.basedomain).term(docSentiment.type)",
"term(docSentiment.type)",
"min(docSentiment.score)",
"max(docSentiment.score)",
"filter(enrichedTitle.entities.type::Company).term(enrichedTitle.entities.text).timeslice(blekko.chrondate,1day).term(docSentiment.type)"
],
"filter": "blekko.hostrank>20,blekko.chrondate>1490425200,blekko.chrondate<1495695600"
}
响应
{
"companies": [
{
"key": "Reuters",
"matching_results": 23
},
{
"key": "Amgen Tour",
"matching_results": 14
},
{
"key": "Qatar Airways",
"matching_results": 13
},
{
"key": "AMC",
"matching_results": 10
},
{
"key": "British Cycling",
"matching_results": 10
},
{
"key": "HSBC UK",
"matching_results": 9
},
{
"key": "Track Cycling Worlds",
"matching_results": 9
},
{
"key": "Univision",
"matching_results": 8
},
{
"key": "Giro",
"matching_results": 6
},
{
"key": "BMC",
"matching_results": 5
}
],
"people": [
{
"key": "George Bennett",
"matching_results": 15
},
{
"key": "Vogel",
"matching_results": 12
},
{
"key": "Chris Taylor",
"matching_results": 11
},
{
"key": "Brent Bookwalter",
"matching_results": 10
},
{
"key": "Rachel Atherton",
"matching_results": 10
},
{
"key": "Barker",
"matching_results": 9
},
{
"key": "Russell Westbrook",
"matching_results": 9
},
{
"key": "John Coates",
"matching_results": 8
},
{
"key": "Tracey Gaudry",
"matching_results": 8
},
{
"key": "Laura Kenny",
"matching_results": 7
}
],
"topics": [
{
"key": "University of California, Irvine",
"matching_results": 44
},
{
"key": "Amgen",
"matching_results": 43
},
{
"key": "Tour of California",
"matching_results": 43
},
{
"key": "Track cycling",
"matching_results": 42
},
{
"key": "Bicycle",
"matching_results": 39
},
{
"key": "Giro d'Italia",
"matching_results": 37
},
{
"key": "World cup competition",
"matching_results": 37
},
{
"key": "Control premium",
"matching_results": 36
},
{
"key": "Irvine, California",
"matching_results": 36
},
{
"key": "Mergers and acquisitions",
"matching_results": 33
}
]
}
我猜测,响应部分来自JSON转储和查询从中获取信息。我试图编写一些代码来过滤掉类似于上面列出的查询的内容。我必须使用什么格式从JSON转储中提取信息?
我试过四处寻找答案,但似乎这个查询只是它周围的代码的一部分(更具体地说只是执行计算的代码)而不是实际设置。
是否有我应该使用的方法?
我有JSON对象存储到一个变量atm,它包含所有需要的信息。