问题
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
回答1:
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
回答2:
Values for the Market parameter
回答3:
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.
来源:https://stackoverflow.com/questions/5677824/bing-search-api-how-to-localize-results