How to restrict Bing Search API Queries by language & region - bing

Using Bing Search API, is there any way to restrict searches by country? That is, an equivalent of Google Custom Search Engine's 'cr' parameter?
For instance, let's say I only want to find web pages from Spain that are available in English.
With Google Custom Search Engine I would use the parameters:
lr=lang_en # language = English
cr=countryES # country = Spain
However, the only related parameters I found for Bing Search API are
Markets, which seems to affect only the page's language
latitude & longitude: user's location (gl with Google), which weighs in location, but is not a strict filter.

The simplest way is not through the param, but rather modifying the search term (which is actually easier).
So let's say you want to search for the term London in Japanese> Simply do so by leveraging their advanced syntax and search for:
London language:ja
Where language:ja restricts the result to Japanese. You can see a list of language codes here.
If you want to include a region with it, add another advanced operator, loc:
London language:ja loc:es
The above search should return search for "London" written in Japanese, while being from Spain. The country code should be the same in the reference.

Related

Retrive all districts based on city name from REST query

I've searched for solution for that problem on here-api documentation but I can't really find it out ! I'm starting doubt if this even possible.
Ok so basicly what i need to know for now:
1. Is this even possible on this platform ?
2. Using exactly which 'module' (eg. PLATFORM DATA EXTENSION,BATCH GEOCODER)
There is no straight solution to get all districts in a city since district concept varies from one place to another(country-specific). Still you can try one of the below options:
administrative-areas-buildings category in places api
city-town-village category in places api
retrieveAreas mode in geocoder api (apply bbox or increase the radius of prox parameter and see if it works for your location)
Search Text in geocoder can also be used if you are search for districts which match a regex
You can check if the above 1) and 2) are applicable to your location using https://places.demo.api.here.com/places/v1/categories/places?at=41.8369%2C-87.684&app_id=DemoAppId01082013GAL&app_code=AJKnXv84fjrb0KIHawS0Tg

Twitter advanced search by date AND location for research purposes

I'm trying to research a topic and I need to get all tweets within 2013 and 2015 and a specific location for two keywords.
I tried to get the results via Advanced Search but I allways get no results.
I tried:
cannabis near:"EspaƱa" within:15mi since:2013-10-07 until:2015-01-01
cannabis near:"Spain" within:15mi since:2013-10-07 until:2015-01-01
Basically, I have a database of scraped press articles sorted by date from a bunch of sources, and I want to know how the agenda of this news sources have an impact on the social media conversation.
I could do it over Reddit if it was the case for the US, but there's no Spanish alternative (well, we have Meneame, but the user base is very left-leaning and I think it will be very narrow).
So I wanted to either scrape the search results or get them via API, but It's not working, and AFAIK I can't do anything similar with Facebook.
One way to achieve this is by using Twitter's geocode operator. In the example below i took Madrid as a center and covered a radius of 600km around it like this:
(canabis OR cannabis) geocode:40.4381311,-3.8196196,600km since:2013-10-07 until:2015-12-31
Try it...
The syntax is as follows:
([your_boolean_search_query]) geocode:[latitude],[longitude],[radius]km since:[] until:[]
one easy way to find latitudes and longitudes of locations is to use Google Maps. Simply navigate to a place using the search box and then copy the latitude and longitude element from the URL line in the browser. Here it is for Madrid. The latitude and longitude are right after the # sign, separated by a comma:
https://www.google.com/maps/place/Madrid,+Spain/#40.4381311,-3.8196196,54451m/data=!3m2!1e3!4b1!4m5!3m4!1s0xd422997800a3c81:0xc436dec1618c2269!8m2!3d40.4167754!4d-3.7037902?hl=en
Try it...

Use Google Places autocomplete vs nearbysearch with rankby=distannce

I am looking to use Google Places autocomplete to help user search for places near him/her. When using autocomplete in the example below, I get establishment that are very far from the location.
https://maps.googleapis.com/maps/api/place/autocomplete/json?input=pizza&types=establishment&location=37.340871,%20-122.029642&rankby=distance&key=mykey
I assume Google considers the popularity of the establishment in the result set. My question: is there a way to get back the list sorted by proximity to the location, i.e. "turn off" the popularity index? (and to get similar functionality to the nearbysearch with autocomplete) ?
Why not just using nearbysearch? because nearbysearch does not perform well when only part of the name is entered as keyword ( I assume nearbysearch assume the 'keyword' parameter is the complete word).
Thanks for your help!

iOS 6 MKMapView Search for Places

I want to search for places such as "Apple Store", "Italian Restaurant" etc. and also for address such as "5th Ave, New York, NY, United States".
How can I search for places and set MKPlacemark for each place I find?
If you are worried about requests limit for Google Maps API, you can use some of open source maps API instead perhaps, like Nominatim API , look at http://wiki.openstreetmap.org/wiki/Nominatim
From iOS 6.1 Apple introduced a new search API - MKLocalSearch. You create a MKLocalSearchRequest using string and region to search in (the region is just a hint for the search, it doesn't guarantee results will fall within this region) and use this request to initialise a MKLocalSearch, which asynchronously gives you the results in an MKLocalSearchResponse object. It was only introduced in january, so it has it's issues at this stage - you only ever get 10 results per search, plus some of the results are strange, but it's definitely worth checking out. There's also no way to specify the type of object (town/business/landmark etc.) you're searching for, which is a shame. Here's a cool tutorial. Note that the more precise the region you supply the better the results.

Bing search API - How to localize results?

How can I use Slovenian search results by default? Our server has German IP and Bing API automatically shows German results first. I have already tried some of the parameters as described in documentation and none of them worked so far.
Thanks
Have you tried to set the Market option?
According to this example page, you should try something like this (note &Market=sl-SL argument):
http://api.bing.net/json.aspx?AppId=your_AppId&Query=your_query&Sources=Web&Version=2.0&Market=sl-SL&Options=EnableHighlighting&Web.Count=10&Web.Offset=0&JsonType=callback&JsonCallback=SearchCompleted
First off, Slovenia is currently not a Bing Market or Country.
There are 2 mutually exclusive options to configure a localization.
Since Slovenia is not yet supported, you might want to use 2. to combine results from relevant markets.
Using mkt and setLang
The values for mkt - Market Code are here.
The query value setLang, "The language to use for user interface strings. Specify the language using the ISO 639-1 2-letter language code. For example, the language code for English is EN. The default is EN (English)."
https://api.cognitive.microsoft.com/bing/v7.0/search?q=microsoft&mkt=en-US&setLang=EN
Using cc and Accept-Language
The values for cc - Country Code are here.
This allows you to specify multiple languages via the header value Accept-Language.
https://api.cognitive.microsoft.com/bing/v7.0/search?q=microsoft&cc=US
True, setting the Accept-Language does very little for the actual
result. If you want to localize outside of a Bing market country, you'll like have to include a translation service.
Values for the Market parameter