Prefere search results in a special country - google-custom-search

I want to do a search for products. I also get some results but they are located in the USA with currency USD but I want to get results from Germany with EUR instead. The language of the custom search is already set to German but the prefered search results are from US.
Is there a possibility to prefere german sides only?
Thanks for your answeres!

You could restrict or boost results from Germany with cr or gl attribute.
cr Restricts search results to documents originating in a
particular country.
gl Boost search results whose country of origin matches the
parameter value.
So, you could try:
<gcse:search cr="countryDE"></gcse:search>
Or:
<gcse:search gl="de"></gcse:search>
Custom Search Element Control API / Supported Attributes
https://developers.google.com/custom-search/docs/element#supported_attributes
If you don't need "global" search, and all, or the most of your CSE implementations should be restricted to Germany, then you could set default cr or gl on https://cse.google.com/ > Search features > Advanced > Websearch restricts. ("Country Restrict" and "Boost Results By Locale".)

Related

Enforce MapBox Geocoding API to return only results with a zipcode

I'm working with MapBox Geocoding API to have suggestions of addresses in the location search feature of my website.
The following is a sample call:
https://api.mapbox.com/geocoding/v5/mapbox.places/Zur.json?country=ch&limit=5&proximity=8.765.432&language=en-GB&access_token=***
My goal is to enforce the api to return only results that include a zipcode.
For example if I input "Zur" (limiting the search to Swiss) I get the following:
- Zürich, Zürich, Switzerland
- Zürich, Switzerland
- Zürich Airport, Flughafenstrasse, Kloten, Zürich 8302, Switzerland
- Zurich, Buchs, Zürich 8107, Switzerland
The expected results should be without the first two lines, as they don't have a zipcode.
I tried implementing myself the removal of results without the zipcode on client side (just after I got an answer from the api), but it is a suboptimal solution (for example it doesn't ensure to have enough results).
I was not able to find such feature in MapBox. Is there a better solution out of there?
Just add ?types=address
See all list of types:
https://docs.mapbox.com/api/search/geocoding/#data-types

Prestashop force customer to select country

I am using Prestashop 1.7.1.1 and I need to force my shop customers to select country. Now it is always pre selected as my store default country (in my case Lithuania). Option to enable "Set default country from browser language" via International > Localization is not acceptable because a lot of customers is using browser language English, but real country is not United States or United Kingdom. For me it will be the best to set --please chose-- as pre selected value and force customer to select one from the list.
You can disable this behaviour by enabling first select themes\classic\templates_partials\form-fields.tpl if you use classic theme.
An alternative may be to use jQuery :
$("#id_country option:first").prop('disabled',false);
$("#id_country").val($("#id_country option:first").val());

Is iTunes search API working correctly?

I’m trying to search all film with word “Seven”. It found 50 films. But some films and its description does not contain word “Seven”. For example film with trackId = 421072264 not contain word “Seven”.
Is iTunes search API working correctly?
https://itunes.apple.com/search?term=Seven&entity=movie
I attached response to Search%3DSeven.txt file.
https://dl.dropboxusercontent.com/u/55328092/Search%3DSeven.txt
Yes this is working correctly, the search defaults to a broader set of data to search on when no attribute parameter is specified in the query.
You can reduce the search parameters by setting a value for attribute the the query, however this will still not stop it from returning films with 7 in their title, this seem to just be a quirk of the search algorithm.
https://itunes.apple.com/search?term=Seven&entity=movie&attribute=movieTerm
Weirdly this returns "Fast & Furious 5 - 7 Collection" before "Seven" which doesn't make much sense.
If it needs to be more precise then a id search can be done which would only return the specified movie
https://itunes.apple.com/lookup?id=534912090
See this link for more details on how to modify the search query and lookup searches:
https://affiliate.itunes.apple.com/resources/documentation/itunes-store-web-service-search-api/#searching

How can I query Wikidata API to get details of all the Korean films?

If possible, i want to return the results in Json or XML format. Is there any ways to do so? Earlier I did it using freebase.com but it is now deprecated. Please help.
This query would look a lot like the one to get the list of all films on Wikidata but adding another filter:
instead of http://wdq.wmflabs.org/api?q=claim[31:11424] (return all the entities marked as instances of film), you would do
http://wdq.wmflabs.org/api?q=claimCLAIM[31:11424] AND CLAIM[495:884] (return all the entities marked as instances of film and South Korea (Q884) as country of origin (P495))
http://wdq.wmflabs.org/api?q=claimCLAIM[31:11424] AND CLAIM[495:423] (the same for North Korea (Q423))
Then to parse the results and get the entities data, it would be the same as for the list of all the films
Remarques:
you will probably need to encode those URLs to get something that looks like: http://wdq.wmflabs.org/api?q=CLAIM%5B31%3A11424%5D%20AND%20CLAIM%5B495%3A884%5D
here is the full API documentation. Notice that this is an experimental API, which might be replaced in the coming year
The overview on Wikipedia may be more complete than Wikidata, as you've noticed yourself also. However, I could only find overviews per year, such as on https://en.wikipedia.org/wiki/List_of_South_Korean_films_of_2015.
To get a list of titles from that page, you would first retreive the raw wikicode of the page: https://en.wikipedia.org/w/index.php?action=raw&title=List_of_South_Korean_films_of_2015, and then run a regular expression such as /\{lang\|[^\|]+\|([^\}]+)/g on the code.
This returns a list of 149 titles.

Google Maps API Geocode Postal Code and set Country code?

I'm using this API call to Google Maps to get the latitude and longitude of a postal code
http://maps.googleapis.com/maps/api/geocode/json?address=2340&sensor=false
The postal code is in Australia. This API call returns locations all around the world with partial matching postal codes in the address.
Is there a parameter I can use to set the country to Australia?
Thanks
The correct way to do this is not via region biasing but rather using component filtering:
https://maps.google.com/maps/api/geocode/json
?components=country:AU|postal_code:2340
&sensor=false
Some demonstrations:
2340
93274
Please note that if you use the components parameter, you don't need to specify the address parameter.
The documentation says that Region Biasing is based on CcTLDs, which would make Australia au (haven't tried it myself).
Although it also states this:
Note that biasing only prefers results for a specific domain; if more relevant results exist outside of this domain, they may be included.