Question

When I search for "football images" on google.co.uk, it knows that I mean the sport that elsewhere might be called "soccer". If I do the same search on google.com, I get American Football.

I'm using the custom search API - how can I tell it that I'm in the UK and would like results relevant to here?

Was it helpful?

Solution 2

Sorry, I ended up answering this myself. I couldn't get any of the instructions under the custom search API itself to work (although the answer offered above was also mentioned there, but this just made my CSE Context XML apparently invalid), but you can make requests to a custom search engine by using the instructions here https://developers.google.com/custom-search/json-api/v1/using_rest and an API key.

OTHER TIPS

You can limit your engine to operate on sites from a particular country via "cr" param, e.g. in Custom Element it looks like this:

<gcse:search cr="gb"></gcse:search>

Google knows some synonyms on the web, but if your particular use case is not correctly recognized you can add it in Control Panel in Search Features > Synonyms

More on synonyms:

This is how I did it;

<gcse:search cr="countryUK"></gcse:search>

You can even return results in a specific language, code shown below returns results only in french;

<gcse:search lr = "lang_fr"></gcse:search>

This is the reference for Google Custom Search Element Control API: https://developers.google.com/custom-search/docs/element?hl=en

Try to set the 'gl' parameter to the country you want. For details, look into CSE:list

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top