如何为一个简单的网站设置一个简单的网站搜索? [英] How to setup a simple site search for a simple website?

查看:50
本文介绍了如何为一个简单的网站设置一个简单的网站搜索?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在维护一个想要进行站点搜索的现有网站.我使用 YAHOO API 实现了搜索.问题是 API 返回了不相关的结果.例如,有一个带有地点列表的侧边栏,如果用户搜索纽约",则顶部结果将是主要内容部分中没有纽约"的页面.我曾尝试将 Yahoo 的 class="robots-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.

我也尝试过 Google 的 Search 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 的风险,我写了一个 博文关于使用 jQuery 为您的网站实施 Bing.

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 的过滤器非常具体地调整结果,并使用 Bing 返回的 JSON(或 XML/SOAP,如果您愿意)结果,以及具有能够更有选择性地选择您实际拥有 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.

您可能应该注意的另一件事是如何有效地使用 @rel 属性,以便搜索引擎知道关系存在于他们正在抓取的实际内容与其链接到的目标内容之间.

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.

这篇关于如何为一个简单的网站设置一个简单的网站搜索?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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