on Aug 5th, 2008Yahoo BOSS – simple, open and awesome

Reached home early yesterday and read an article about Yahoo BOSS and its open nature. In my effort to kill time, till dinner, I sat and read through the documentation for BOSS and it turns out its the easiest open search ever. I used the Google Coop as my site search but, somehow the techie inside me couldn’t rest at the thought of someone else doing the tech for me. BOSS looked really tempting with its good results and recent indexes; I sat down to build my site search.

BOSS is simple. Really really simple and can do wonders if you are planning to build a search engine with your own flavor. Unlike other searches, BOSS gives you XML/JSON, meaning you can re-order results and present them in any way you like. Add flash, css, javascript, canvas elements whatever to build that unique search experience. After the cuil ripoff Yuil, which got taken down and was relaunched again as 4Hoursearch (why did they call it that ? figure it out Einstein !!), I was sure BOSS would be easy, but didn’t know it would be this easy.

Its only recently that I started learning Python, and I suck at it, so I picked my old favorite PHP as the language of choice ( I suck at PHP too, but suck less compared to Python). Got myself an Application ID to use BOSS. Used PHP SimpleXML parser to get a URL of choice and Voila, I had my results in an array. Wrote some really rudimentary CSS to match the aesthetics of my site and my site search was done .

Check out my Yahoo BOSS powered site search here !!

If it wasn’t for my crappy PHP skill level, Im sure I could have wrapped up the entire thing, right from “Duh, what is BOSS ?” to the implementation, in under an hour. If I do find more time to kill whilst I wait for dinner, I shall experiment with different displays for search results from BOSS. Y! BOSS is truly open and in keeping with the Open Source spirit, I have shared my rudimentary site search code. You wont believe it but the code , with proper convention, HTML and CSS comes up to 65 lines . Isn’t it awesome ??

Get the code for site search here.

Another wonderful manifestation of this concept is that you can now build custom search engines that will search only the sites that you catalog for information you need. Check out Y! BOSS.

Tags: , , ,

21 Responses to “Yahoo BOSS – simple, open and awesome”

  1. vik on 05 Aug 2008 at 5:00 pm

    very nice search implementation
    btw, no need to even say powered by yahoo boss – you’re in full control of attribution :)
    also if you could post your boss-src package to the ysearchboss group that would be awesome. i think lots of people can benefit from your php solution

  2. phil on 06 Aug 2008 at 1:01 am

    I’m trying a search now on http://riteshnayak.com/boss.php and am not getting any results.

  3. Ritesh on 06 Aug 2008 at 12:35 pm

    Seems to be working fine Phil. Its a site search utility, so it only searches for information on my site . For a general search utility, please wait until my next blog post.

  4. phil on 06 Aug 2008 at 10:07 pm

    I seem to be missing something. I tried searching “PHP”, “python” and “boss” and got no results.

  5. Ritesh on 06 Aug 2008 at 10:30 pm

    Hey Phil,
    There are two possible explanations:

    1. if you are trying my site search, then http://riteshnayak.com/boss.php is working fine. PHP and boss are returning about 4 results each. Python doesnt return anything coz I haven’t written anything abotu python. You can also try http://riteshnayak.com/morey_intro.html , its a generic yahoo search split into three columns.

    2. If you are trying to run my code, then please re-download the source from my site. There was a small bug in the code, which I have fixed. If you want to fix the code yourself, then find the form tag and remove the action=”boss.php” and make it action=”" That should do the trick. Let me know if you have problems, also make sure you have your appid and your personal site address mentioned at the top of the code.

    Ritesh

  6. Denis on 14 Aug 2008 at 11:11 am

    Hi there,
    greate sample… !!!

    For me it’s work great :-)

    can you make an example with a pictures also please ?

    Thanks in advance

  7. Snoop Search on 08 Dec 2008 at 9:56 pm

    Mr. Nayak,
    I wanted to thank you for your excellent example script. I recently modified it to make http://www.snoopdizzle.com for fun. Hopefully someone finds it funny.

    Thanks again,

    John

  8. Snoop Dogg Search on 31 Dec 2008 at 1:51 am

    Mr. Nayak,
    It is me again. I noticed a problem with your search script while I was building a new search engine, and it looks like it is present on both of your search engines. I found that any time quotes are added to a search the results got all messed up. Here’s and example of searching for “yahoo” on your widescreen search:

    http://riteshnayak.com/morey.php?query=%22yahoo%22

    After doing some reading it looks like the problem is due to the way your php is set up (the same for mine). Your php configuration has magic_quotes_gpc on, and this adds slashes before the quotes for the search query. To fix it the urlencode line needs to be changed to this:

    $searchQuery = rawurlencode(stripslashes($_REQUEST['query']));

    Here is more info on stripslashes:

    http://www.php.net/stripslashes

    Here is the updated result for the same search (“yahoo”) with my snoop search site:

    http://www.snoopdizzle.com/?query=%22yahoo%22

    I think it will be secure because the urlencode happens directly after. What do you think?

    Thanks again for your wonderful example.

    John

  9. Ritesh on 03 Jan 2009 at 9:10 am

    Yes, I realize the error too. Thanks for the heads up. Will definitely change that re upload the source. Thanks again.

  10. Gianni on 07 Jan 2009 at 8:22 am

    b1A0RTuBLs8DW

  11. Mike on 16 Jan 2009 at 9:04 pm

    Ritesh,

    Thank you for making your code available. I have done as you instructed (added my appid and website address) but cannot get the application to run. I have checked my appid against BOSS with a sample query string and receive XML results. Any suggestions?

    Thank you for your time.

    Mike

  12. Ritesh on 17 Jan 2009 at 10:25 am

    I have reuploaded the code for site search with some changes as suggested by John.

    @Mike You have to change the website address to your site without the http:// or the www and then try it. It must work. Its right now hardcoded to my site’s url. Just replace that with your site’s url. Also I run PHP5 . I have checked my code and it works fine.

  13. [...] Links on this subject: webmaster-source.com marcgrabanski.com riteshnayak.com Vote or add this article [...]

  14. Robert on 05 Feb 2009 at 3:10 am

    Hello Ritesh,

    Your script is great and I’m using it on my dutch search engine http://www.zoekzoeki.nl. But I also want to let my users do image and news search.
    What do I need to change in order to get your script to retrieve images and news? When I change “web” into “images” or “news” I get all kinds of error messages. So I guess there is more to it then that. Can you tell me or even put up an amended script for image and news search?

  15. sam on 05 Feb 2009 at 4:57 am

    Ritesh,

    Thanks for sharing the code!

    I’m having problems while trying to add multiple sites separated by commas.

    I get “no results found” when I add more then one site.

    What am I doing wrong?

  16. Ritesh on 05 Feb 2009 at 8:47 am

    @Robert, the url to hit for news search is slightly different , please find the same here and make the necessary modifications.

    For News Search: http://developer.yahoo.com/search/boss/boss_guide/News_Search.html

    For Image Search : http://developer.yahoo.com/search/boss/boss_guide/Submit_Image_Queries.html

    This must do!!

  17. Ritesh on 05 Feb 2009 at 8:48 am

    @Sam when adding multiple sites, make sure you dont add the http:// or the http://www.

    Sites should be added like yahoo.com,news.com,flickr.com etc

  18. itsmeritesh (Ritesh M Nayak) on 05 Feb 2009 at 11:16 am

    Supporting OS scripts is tough. I shared just one file and look at the queries I get http://is.gd/1feP hats off to people like wp

  19. sam on 05 Feb 2009 at 3:05 pm

    @Ritesh, that’s what I did. It doesn’t work. Are there any other changes that need to be made?

  20. Ritesh on 05 Feb 2009 at 4:14 pm

    Sam, There is a change in the API specifications, which is why the older code isnt working. you can add a new parameter like this sites=abc.com,cnn.com
    Just add this at the end of your query string and remove the +site:riteshnayak.com variable. Should work after that. Wondering how my site search still works ?

  21. Robert on 04 Mar 2009 at 4:43 am

    Hi Ritesh,

    I have tried to amend the code quite a few times now but still no luck. Can I ask you to post a script for download that does image search? I understand to little of PHP to get this working my self. Or could you show exactly what to change in your script so that it does image search? I’d really, really, really appreciate it.

Trackback URI | Comments RSS

Leave a Reply