开发者

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 开发者_JS百科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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜