Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Bing search API - How to localize results?

Tags:

bing

bing-api

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

like image 362
Miha Avatar asked Oct 25 '25 15:10

Miha


2 Answers

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
like image 173
Max Galkin Avatar answered Oct 27 '25 21:10

Max Galkin


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.

like image 28
Martin van Delft Avatar answered Oct 27 '25 20:10

Martin van Delft



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!