views:

92

answers:

3

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.

I also tried out Google's Search API but am having the same problem.

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?

+2  A: 

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.

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.

Phil.Wheeler
That's ok. I would prefer using an easy to use API rather than spending time writing my own.
Matt McCormick
Code samples illustrated and available for download. :-) I found Bing to be really easy and I haven't worked with a search API before in my life (unless you count IIS Indexing - ugly).
Phil.Wheeler
I tried the search on bing and the top results are more relevant as they do not include the sidebar content. I will give their API a try.
Matt McCormick
A: 

First, post a link to your website... we can probably help you more if we can see the problem.

It sound like you're doing it wrong. Google Search should work on your website, unless your content is hidden behind javascript or forms or something, or your site isn't properly interlinked. Google solved crawling static pages, so if that's what you have, it will work.

So, tell me... does your site say New York anywhere? If it does, have a look at the page and see how the word is used... maybe your site isn't as static as you think. Also, are people really going to search your site for New York? Why don't you input some search terms that are likely on your site.

Another thing to consider is if your site is really just 50 pages, is it really realistic that people will want to search it? Maybe you don't need search... maybe you just need like a commonly used link section.

Andrew Johnson
The site is www.rimonlaw.com. The search works, just that the top results are irrelevant. Also, for some reason the search works well on google.com but if I use the Google Search API, I get different results (which are worse). Unfortunately, the site was developed by someone else and they aren't going to pay me to organize it better so I'm stuck with the current layout.If you search for "New York" the second result goes to an attorney where New York is not listed on the page. The result is coming from the sidebar where "New York University" is listed in the drop down.
Matt McCormick
A: 

The BOSS Site Search Widget is pretty slick.

I use the bookmarklet thing but set as my "home" page in my browser. So whatever site I'm on I can hit my "home" button (which I never used anyway) and it pops up that handy site search thing.

dreeves