Miha
Miha

Reputation: 73

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

Upvotes: 4

Views: 2262

Answers (3)

Martin van Delft
Martin van Delft

Reputation: 457

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.

Upvotes: 2

shweta
shweta

Reputation: 8169

Values for the Market parameter

Upvotes: 1

Massimiliano
Massimiliano

Reputation: 17000

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

Upvotes: 2

Related Questions