It does appear that sort by distance is not working. As a workaround, I suggest using YQL as Josh mentioned (wherein YQL sorts the results before returning to you), or do the sorting on your side.
Brian Cantoni
Yahoo! Developer Network
In densely populated areas the workaround is insufficient. Consider this search for businesses in Seattle, WA:
YQL Console:
SELECT id,Title,Distance FROM local.search(0,20) WHERE query="*" AND location="seattle, wa" | SORT(field="Distance")The first six locations have a distance of 0.00 miles. After that
it jumps to 6.2 miles and higher. Plotting these points on a map makes a person think that Seattle doesn't have any businesses in it; it shows a few results by the city center and many results miles away.
Looking at the underlying Local Search query reveals the problem:
Local Search API:
query=*&location=seattle,wa&start=1&results=20 (requires an App ID to test)
The first few results have a distance of 0.00 miles, but then you immediately jump up to the farther distances of 6.2 miles and higher. YQL sorts these results correctly, of course, but the underlying data is so whacked out that
even the YQL query ends up being worthless.
Increasing the number of results grabbed doesn't help. Even if I grab from local.search(0,200) the closest business is 6.12 miles away.
Searching for a more specific address, like "724 Pine Street, Seattle, WA 98101" doesn't help either. Even when I grab 200 addresses the nearest business is 0.2 miles away, and after that
5.19 miles away:
YQL Console:
SELECT id,Title,Distance FROM local.search(0,200) WHERE query="*" AND location="724 Pine Street, Seattle, WA 98101" | SORT(field="Distance")This is an issue for our application, which is intended to help people with disabilities find work near their homes; searches in densely populated areas are effectively useless.
-Josh