如何在我的网站上使用 Bing 作为搜索引擎? [英] How to use Bing as the search engine on my site?

查看:85
本文介绍了如何在我的网站上使用 Bing 作为搜索引擎?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Bing 是否有类似于 Google 自定义搜索或 Yahoo 的选项,我可以在其中使用 Bing 来支持我网站上的搜索结果?

Does Bing has an option similar to Google Custom Search or Yahoo where I can use Bing to power the search results on my site?

情侣要求:

  • 使用 ASP.NET 站点(是一个 .NET 项目)
  • 在我自己的网站上托管搜索框和结果
  • 能够自定义结果的外观以匹配我的网站(完全控制是理想的,但我知道免费解决方案是不可能的)

我搜索了 Bing 自定义搜索并找到了这个:http://www.bing.com/网站所有者/ 但这不是我正在寻找的.

I did a search for Bing custom search and found this: http://www.bing.com/siteowner/ but it's not exactly what I am looking for.

推荐答案

Bing 使用的查询字符串是:

The query string Bing uses is:

http://www.bing.com/search?q=&src=IE-SearchBox&FORM=IE8SRC

(这是来自 IE 中 Bing 搜索提供程序的模板 URL).您所要做的就是在 q 参数之后插入您的搜索词.测试这一点的一个好方法是实际执行搜索并在浏览器的地址框中查看 url:

(this is the template URL from the Bing search provider in IE). All you have to do is insert your search terms after the q parameter. A good way to test this is to actually execute a search and see the url in the address box of the browser:

http://www.bing.com/search?q=how+to+query+bing&src=IE-SearchBox&FORM=IE8SRC

您可以删除 srcFORM 参数,Bing 只会将它们用于统计目的.

you can drop the src and FORM parameters, Bing will just be using those for statistical purposes.

要让结果出现在您自己的页面中,请使用 iframe,为其指定一个 id,并将其 src url(使用 javascript)设置为您构建的搜索 url.

To get the results to appear in your own page, use an iframe, give it an id, and sets its src url (using javascript) to the search url you have constructed.

var frame = document.getElementById('mySearchFrame');
if (frame != null)
    frame.src = 'http://www.bing.com/search?q=' + mySearchTerms;

请注意,如果您想设置页面样式,则必须从背后的代码中查询 Bing 并抓取"结果并将它们放入您自己的页面中.(或者您可以将页面发回但在此之前修改其内容,但这样做将违反 Bing 的使用条款 - MS 为您免费提供 Bing,但这是根据他们的条款,这意味着您将无法删除任何广告或更改页面的外观和感觉 - 世界上没有免费乘车 :)

Note that if you want to style the page then you will have to query Bing from code behind and "scrape" the results and place them into your own page. (Or you could just send the page back but modify the contents of it before doing so, but to do this will be violating Bing's terms of use - MS supply Bing for you to use for free, but it is on their terms, which means you will not be able to delete any advertising or change the look and feel of the page - there are no free rides in this world :).

这篇关于如何在我的网站上使用 Bing 作为搜索引擎?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆