YQL sample query returns max 260 results

百般思念 提交于 2019-12-08 09:27:11

问题


I am following YQL sample query

select * from local.search(500) where query="sushi" and location="san francisco, ca"

but I get 260 max count instead of 500. I tried also to use limit 500 after 'where' and different keywords, always get maximum 260 results. How do you increase it?


回答1:


The underlying API that the local.search table uses (Yahoo! Local Search Web Service) has restrictions on the number of results returned.

The results parameter (the number of results "per page") has a maximum value of 20.

The start parameter (the offset at which to start) has a maximum value of 250.

Since you ask for the first 500 results, YQL makes multiple queries against the Local Search API returning 20 results at a time. Therefore the start values are 1, 21, 41, ... 241. This brings back 260 results, as you have seen.

Since the YQL query asks for more results, the next start value is tried (261) which is beyond the allowed range so the underlying service returns an error (with the message "invalid value: start (261) must be between 1 and 250"). If you turn on "diagnostics" in the YQL console, you will see the "Bad Request" being returned.

Nothing you do to the query will bring back more results than the underlying service allows.




回答2:


I figured out, I was missing paging number, so 0++ will work

select * from local.search(0,500) where query="sushi" and location="san francisco, ca"


来源:https://stackoverflow.com/questions/6400121/yql-sample-query-returns-max-260-results

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!