我一直在尝试Yahoo YQL本地搜索,这是我最初的查询:
select * from local.search where zip='94085' and query='pizza'
它确实检索了这样的结果:
<Result id="21332021" xmlns="urn:yahoo:lcl">
<Title>Pizza Depot</Title>
<Address>919 E Duane Ave</Address>
<City>Sunnyvale</City>
<State>CA</State>
<Phone>(408) 245-7760</Phone>
<Latitude>37.389001</Latitude>
<Longitude>-122.003952</Longitude>
<Rating>
<AverageRating>3.5</AverageRating>
<TotalRatings>6</TotalRatings>
<TotalReviews>6</TotalReviews>
<LastReviewDate>1307988793</LastReviewDate>
<LastReviewIntro> Weve been coming to this Pizza Depot every week after softball games for years. The owner is very friendly and always does whatevers necessary to please the customer. Hes even stayed open late just for us after a game that didnt end until 9:45. Sometimes it gets a little busy at night, but isnt that a sign of a good pizza place? If it was always empty, then there might be something to complain about. Our group leaves satisfied week after week...</LastReviewIntro>
</Rating>
<Distance>0.75</Distance>
<Url>http://local.yahoo.com/info-21332021-pizza-depot-sunnyvale</Url>
<ClickUrl>http://local.yahoo.com/info-21332021-pizza-depot-sunnyvale</ClickUrl>
<MapUrl>http://local.yahoo.com/info-21332021-pizza-depot-sunnyvale?viewtype=map</MapUrl>
<BusinessUrl>http://www.pizzadepot-sunnyvale.com/</BusinessUrl>
<BusinessClickUrl>http://www.pizzadepot-sunnyvale.com/</BusinessClickUrl>
<Categories>
<Category id="96926236">Restaurants</Category>
<Category id="96926243">Pizza</Category>
</Categories>
</Result>
但是没有邮政编码。任何人都可以帮助我包括那个吗?使用它们也不起作用:
select zip, * from local.search where zip='94085' and query='pizza'
select zip from local.search where zip='94085' and query='pizza'
TIA
答案 0 :(得分:2)
虽然不是最佳解决方案,但由于邮政编码不是结果中包含的字段,因此可以通过为每个结果运行其他查询来查找邮政编码。在以下查询中,将文本更改为所需的纬度和经度。
SELECT postal FROM geo.placefinder WHERE text =“37.389001,-122.003952”AND gflags =“R”
为了减少伤害,YQL目前不支持表连接...至少不是典型意义上的,所以不可能将上述查询合并到当前查询中。
供参考:
geo.placefinder参数: http://developer.yahoo.com/boss/geo/docs/control-parameters.html