问题描述
我保持一个现有的网站,想要一个网站搜索。我实现使用YAHOO API搜索。问题是,该API返回不相关的结果。例如,有一个与地方列表的侧边栏和如果纽约结果的最前面用户搜索将成为网页没有纽约中的主要内容部分。我曾尝试加入雅虎类=机器人-nocontent
来然而侧边栏,这是两个星期前,并一直没有更新。
I'm maintaining an existing website that wants a site search. I implemented the search using the YAHOO API. The problem is that the API is returning irrelevant results. For example, there is a sidebar with a list of places and if a user searches for "New York" the top results will be for pages that do not have "New York" in the main content section. I have tried adding Yahoo's class="robots-nocontent"
to the sidebar however that was two weeks ago and there has been no update.
我也尝试了谷歌的搜索API,但我有同样的问题。
I also tried out Google's Search API but am having the same problem.
本网站有大部分静态内容和50页共所以它是非常小的。
This site has mostly static content and about 50 pages total so it is very small.
我怎样才能实现一个简单的搜索,只有在搜索页面的主要内容部分?
How can I implement a simple search that only searches the main content portions of the page?
推荐答案
在冠冕堂皇的完全自我推销,以及对你推又API的风险,我写了一个的。
At the risk of sounding completely self-promoting as well as pushing yet another API on you, I wrote a blog post about implementing Bing for your site using jQuery.
在使用jQuery方法的好处是,你可以调整结果的基础上传递到API的过滤器,并与JSON玩弄相当明确(或XML / SOAP,如果你preFER)导致兵返回,以及具有了更多的选择什么数据,你实际上有jQuery的显示能力。
The advantage in using the jQuery approach is that you can tune the results quite specifically based on filters passed to the API and playing around with the JSON (or XML / SOAP if you prefer) result Bing returns, as well as having the ability to be more selective about what data you actually have jQuery display.
你应该知道的另一件事是如何的您的内容(特别是链接)让搜索引擎知道的关系是什么他们爬的实际内容和目标内容之间它链接到。
The other thing you should probably be aware of is how to effectively use @rel attributes on your content (esp. links) so that search engines are aware of what the relationship is between the actual content they're crawling and the destination content it links to.
这篇关于如何设置一个简单的网站寻找一个简单的网站?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!