Build your own search engine
- Tags
- Posted
- Tue 19 Aug, 2008
- Comments
- 1
I recently used Yahoo!’s BOSS search API to build search.helicoid.net—a tiny Rails app that searches our public-facing web sites. It’s tied into our 404 pages which makes it easy for people to find things when they’re lost.
So how would you like to build your own search engine? The BOSS API searches Yahoo!’s index without any restrictions. This means you can freely search Yahoo!’s index with minimal hassle. The BOSS API is also incredibly simple to use.
To get started, you need to sign up and get a BOSS ID. Visit the BOSS page, then click “Build an Application.” I selected Browser Based Authentication in the sign-up form.
Once you’ve got your appid using the API is easy. Simply send requests to the service like this:
http://boss.yahooapis.com/ysearch/web/v1/{query}?appid=xyz[¶m1=val1¶m2=val2
... and you’ll get back nicely formatted XML.
To use our example Ruby on Rails code to build your own site, ensure you’ve got the following gems installed:
- open-uri
- will_paginate
- hpricot
Then download our Rails BOSS example: code.helicoid.net/files/search_example.zip
Next, unzip our example code and open config/environment.rb. Enter your BOSS ID at the bottom of the file. You should then be able to run script/server and try out the app.
To customise the way the search works, take a look at app/models/search.rb and scroll down to line 53—this is where the search request is generated. Notice how I’ve supplied “site:helicoid.net” as part of the query: this makes Yahoo! search Helicoid’s sites.
If you create anything interesting with this please let us know via the comments!

Stephanie
Jan 27
Cool! I will check it out. Thanks