0

我想在我的桌面应用程序中使用 yelp 搜索引擎来获取所有位置,但我有一个大问题。事实上,我的请求中只能搜索 20 个业务。我认为 YelpSharp 中使用的 SearchOption 中可能存在一个限制参数,但是我最多只能得到 20 个结果。

Yelp y = new Yelp(options);
List<Business> SearchList = new List<Business>();
List<YelpSharp.Data.Business> l = new List<YelpSharp.Data.Business>();
SearchOptions searchOptions = new SearchOptions();
searchOptions.GeneralOptions = new GeneralOptions()
{
    term = "Dentist"             
};

searchOptions.LocationOptions = new LocationOptions()
{
    location = "New york"
};


 var task = y.Search(searchOptions).Result.businesses;

这是我的应用程序中使用的 Yelp REST API 请尽快回复。

4

1 回答 1

1

这是来自Yelp Developer Support google groups 的答案,答案非常令人失望 :( 但是对于超过 20 条记录,即最多 40 条,我们可以通过文档“常规搜索参数”部分中定义的参数使用分页,并在此处给出其实现提示

我在 Ruby on Rails 项目中使用它,以访问第一个20结果

Yelp.client.search(params[:term], { term: 'restaurants' , limit: 20 , offset: 0 , sort: 2})

对于结果21-40,更改偏移量的值

Yelp.client.search(params[:term], { term: 'restaurants' , limit: 20 , offset: 20 , sort: 2})
于 2015-10-22T10:26:56.140 回答