尝试使用提供的Ruby包装器实现实际的API。希望返回在一定数量的地理点的所有酒吧。我的查询如下所示:
factual.table("places").search("category_id"=>"312").geo("$circle" => {"$center" => [40.7811, -73.98], "$meters" => 10000}).rows这将返回200:OK响应,但没有记录(即使该位置在曼哈顿)。我很确定我传递类别信息的方式有问题。
根据API文档,我还尝试像这样传递类别数据,这将返回一个语法错误:
factual.table("places").filters("category_ids" => {"category_ids":["6"]}).geo("$circle" => {"$center" => [40.7811, -73.98], "$meters" => 10000}).rows这将返回实际错误*引用未知字段category_ids*
factual.table("places").filters("category_ids" => {"$in" => ["312", "338"]}).geo("$circle" => {"$center" => [40.7811, -73.98], "$meters" => 10000}).rows我在这里遵循文档示例,并使用v3:https://github.com/Factual/factual-ruby-driver/wiki/Read-API和这里:http://developer.factual.com/display/docs/Places+API+-+Global+Place+Attributes
编辑:
我还尝试将filters方法更改为search,如下所示:
factual.table("places").search("category_ids" => {"$in" => ["312", "338"]}).geo("$circle" => {"$center" => [40.7811, -73.98], "$meters" => 10000}).rows这将返回地址中包含338的记录,而与类别无关。非常奇怪。几个小时以来我一直在尝试不同的东西。我很确定这是一个关于我传递类别信息的问题。我正在尽可能地紧跟文档,但我不能让它工作。
发布于 2012-11-25 02:01:01
尝尝这个
factual.table("places").filters("category" => "Bars")
.geo("$circle" => {"$center" =>[40.7811, -73.98] , "$meters" => 1000}).rowshttps://stackoverflow.com/questions/13543367
复制相似问题