Tutorial: Create a Yahoo BOSS powered Site Search Engine

Published in: google custom search - yahoo

yahoo-boss While it is extremely easy to implement Google Custom Search in your site, the Google service is kind of limited in the sense that you little control over the search results that display on your site. You can neither reorder search results nor can you include additional information in the search pages.

Enter Yahoo BOSS, a service overcomes most limitations of Google Custom Search. It lets you display search results in the format you like, or add image thumbnails to your results page (similar to Cuil) or you can even hide certain web pages from appearing in search results.

If you like to experiment with Yahoo! Boss for your own site search, here’s a quick tutorial to help you get started. Just apply for an AppID and then replace the appropriate values in the following PHP file.

// Get the Yahoo BOSS AppID from https://developer.yahoo.com/wsregapp/ define (‘APP_ID’, ‘YOUR_APPID_HERE’);

// Restrict site search to your own domain - replace labnol.org $query = $_GET [‘q’] . ‘+site:labnol.org’;

// Get search results from Yahoo BOSS as an XML* $API = ’http://boss.yahooapis.com/ysearch/web/v1/’; $request = $API . $query .‘?format=xml&appid=‘. APP_ID;

$ch = curl_init($request); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_HEADER, 0); $xml = simplexml_load_string (curl_e xec($ch));

// Display search results - Title, Date and URL. foreach ($xml->resultset_web->result as $result) { print ’’.$result->title.’
’; }

*You can directly use file_get_contents() instead of the cURL library but some web hosts (like Dreamhost) do not allow fopen on external files.

Tweak Your Search Results

These results (like Gmail, Google Chrome, India) are presented in a plain vanilla interface but you could easily wrap them in a WordPress plug-in that displays addition information next to search results like associated thumbnail images, tags, number of comments, etc. To see all this in action, check out the gmail search on TechCrunch.

Ads in Yahoo! Boss

Yahoo! has promised that they’ll brings ads to Yahoo! Boss so you will be able to monetize site search in the same manner as AdSense for Search. It may however be limited to US residents only since you require a valid SSN to gain entry into the Yahoo Ad Network.

Update: Make sure that you use the ClickURL value for the HREF value in your search results and not the direct URL as this is a requirement according to their BOSS API terms of use.

📮  Subscribe to our Email Newsletter for Google tips and tutorials!
Published in: google custom search - yahoo

Looking for something? Find here!

Meet the Author

Web Geek, Google Developer Expert
Amit Agarwal

Amit Agarwal is a Google Developer Expert in Google Workspace and Google Apps Script. He holds an engineering degree in Computer Science (I.I.T.) and is the first professional blogger in India. He is the developer of Mail Merge for Gmail and Document Studio. Read more on Lifehacker and YourStory

Get in touch

Google Add-ons

Do more with your Gmail and GSuite account

We build bespoke solutions that use the capabilities and the features of Google Workspace for automating business processes and driving work productivity.

  1. Mail Merge with Attachments
    Send personalized email to your Google Contact with a Google Sheet and Gmail
  2. Save Emails and Attachments
    Download email messages and file attachments from Gmail to your Google Drive
  3. Google Forms Email Notifications
    Send email notifications to multiple people when a new Google Form is submitted
  4. Document Studio
    Create beautiful pixel perfect documents merging data from Google Sheets and Google Forms
  5. Creator Studio for Google Slides
    Turn your Google Slides presentations into animated GIFs and videos for uploading to YouTube