如何增加 freebase API 结果限制 [英] how to increase freebase API result limit
问题描述
我在 freebase 的文档中找不到任何关于它的内容,但似乎他们将结果数限制为 100.例如:
I can't find anything in freebase's docs about it but it seems they limit the number of results to 100. For example:
[{
"type":"/base/popstra/celebrity",
"name":null
}]
仅返回 100 个结果,而
Returns only 100 results whereas
[{
"type":"/base/popstra/celebrity",
return:"count"
}]
说有 6244 个结果.有谁知道如何获得其余的?我知道我可以通过一些参数(如国家/地区)来限制查询,然后汇总结果,但我更喜欢不那么笨拙的东西.
Says there are 6244 results. Does anyone know how to get the rest of them? I know I can limit the queries by some parameter like country and then aggregate the results but I'd prefer something less hacky.
推荐答案
您可以使用 limit
属性来请求更多结果.但是,获取大量数字可能会导致查询超时.
You can use the limit
property to request more results. However, fetching large numbers can give you a query timeout.
更可靠的方法是使用 cursor
属性.传入 true
的 cursor
值.您将获得一批结果,但您还将在响应中获得 cursor
的新值.重复您的查询,但替换新的 cursor
值以获得下一批结果.通过这种方式,您甚至可以获取非常大的数据集.
A more reliable way is to use the cursor
property. Pass in a cursor
value of true
. You'll get a batch of results, but you'll also get a new value for cursor
in the response. Repeat your query, but substitute in the new cursor
value to get the next batch of results. In this way you can fetch even a very large set of data.
更多信息:http://www.freebase.com/docs/mql/ch04.html#envelopeparameters
这篇关于如何增加 freebase API 结果限制的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!