views:

989

answers:

1

I'm losing some hair over Google's AJAX API currently. What I do is turning structured location data into a Google local search API query in order to give users an alternative result list of places.

ex.:

http://ajax.googleapis.com/ajax/services/search/local?v=1.0&key=XXX&hl=en_US&mrt=localonly&rsz=large&q=pizza+Neustadt+DE

However, the API behaves very oddly at times, often not taking into account certain parameters I pass to it. For instance:

If I search for "term Rome Roma IT" on Google Maps, then it finds all terms in Rome as expected. If I repeat the same search on the API, I get zero results (I have to remove either 'Roma' or 'Rome' for it to work -- Roma is the administrative region here, and Rome the city name).

Why is that?

Another example. There is like 20 different towns, cities and boroughs called Neustadt in Germany. Now, when I search on Google Maps, it only finds one, unless I specify an additional qualifier, like a region or something.

Now, on the API level I kinda expected that when passing lat/lon parameters along with a query for Neustadt then it would be clever enough to pick the correct Neustadt by looking at the geo coding. But that doesn't happen, it always picks the same Neustadt and ignores the geo data.

q=pizza+Neustadt+DE&sll=48.8053,11.7579

I had similar problems when doing bounding box searches. The bounding box seems to be ignored completely, since I'm still getting result data which is a hundred kilometers off:

q=pizza+Neustadt+DE&sll=48.8053,11.7579&sspn=0.00001,0.00001

The last result is not even in the same city; shouldn't the tiny bounding box not result in any data whatsoever? I could even pass a zero size BBox and I would still get results.

I know there's an actually quite extensive documentation for the Local Search API, but it never goes into detail about which parameters are used when and how a query has to be structured and is evaluated, which makes it very difficult to get decent results.

Do you have any hints, tipps, suggestions on how to get to grips with Google Local search?

UPDATE: I just found something REALLY odd. Could someone please go to this website:

http://code.google.com/apis/ajaxsearch/documentation/localsearch/index.html

open firebug, and monitor the HTTP traffic when typing in this search query:

test Rome Roma IT

You will get a bunch of results on the map. Now copy the URL that was contacted via AJAX and send a request to it on the command line:

curl "http://www.google.com/uds/GlocalSearch?key=internal-sample&v=1.0&rsz=large&sll=41.97684819454683%2C12.486648559570312&sspn=0.204185%2C0.549316&q=test%20Rome%20Roma%20IT&lssrc=lsc&lscstyle=final&start=0&callback=_callbacks_._5g139yfuc"

Now I get ZERO results. How can that possibly be? It's definitely not the key or callback args, I removed them without any change to the outcome of that query.

Is Google extending their search results when a query comes from one of their servers?

+2  A: 

I've encountered exactly this same problem and it seems to be down to a combination of licensing issues and the fact that what Google exposes via its APIs and what it displays in the Maps/Google search pages are a combination of different searches (search, maps, base, data etc.etc.)

On the licensing issue, it seems that Google can display more information when a user goes via the browser, compared to requests via API calls (which could theoretically be automated).

See here for example.

davek
Thanks for the pointer. Any ideas about the ignored bbox parameters?
Matthias
I provided either the sll params or the address elements as part of the "q" term, but not both together.
davek
I just updated my question with another very odd observation. Can you confirm that? Thanks Dave.
Matthias