Home | Index

SearchMonkey Guide

Developer Quickstart

This section is a "lightning tour" of how to create an example "Hello World" SearchMonkey application. The application is limited in two key ways:

The goal of this tutorial is to get through the SearchMonkey flow with minimal explanation, so that you have a basic, working application to try out on real Yahoo! searches. For more complex tutorials with more detailed explanations, refer to “Creating a (Page) Custom Data Service”, “Creating a (Web Service) Custom Data Service”, and “Creating a Presentation Application”.

  1. Enter the SearchMonkey developer tool and click Create a new application. The Basic Info screen displays.

  2. Enter a Name of “Test Application: Display Page Info”. Select Infobar as the application type. Read the Terms of Service and select the Terms of Service checkbox.

    Click Next Step. The URLs screen displays.

  3. Enter a Trigger URL Pattern of “*”. This causes your application to trigger on all search results. Note that this extremely general pattern forces the application to be an Infobar; Enhanced Results require a more specific trigger URL pattern.

  4. Enter the following three Test URLs:

    • http://www.hp.com

    • http://www.spiegel.de

    • http://www.irs.gov/pub/irs-pdf/f1040.pdf

    Click Next Step. The Data Services screen displays.

  5. Verify that the default Yahoo! Index data service is selected. You may optionally click “Contains 16 data fields” to inspect the type of information in the Yahoo! Index.

    Click Next Step. The Appearance screen displays.

  6. Erase the contents of the textarea and replace it with this PHP snippet:

    public static function getOutput() { $ret = array(); $ret['dict'][0]['key'] = "Category"; $ret['dict'][0]['value'] = Data::get('yahoo:index/dc:subject/dc:title'); $ret['dict'][1]['key'] = "Language"; $ret['dict'][1]['value'] = Data::get('yahoo:index/dc:language'); $ret['dict'][2]['key'] = "MIME Type"; $ret['dict'][2]['value'] = Data::get('yahoo:index/dc:format'); return $ret; }
  7. Click Save and Refresh at the bottom of the screen. The Preview Pane displays an example search result for http://www.hp.com, with an Infobar appended to the bottom. Click to expand the Infobar.

    You should see the page’s Category (taken from the Yahoo! Directory), the page’s Language (English), and the page’s MIME Type (text/html). Use the arrows to cycle through your three test results and examine the Infobars for http://www.spiegel.de and the IRS PDF.

    When you are done, click Next Step. The Confirmation screen displays.

  8. Click Try this Presentation Application. Click Save to confirm that you want to add the application to your search preferences. This displays a dialog. Click Try it out on Yahoo! Search.

  9. Search on any topic of interest, and note that your test application triggers on all URLs, displaying an Infobar for each search result.

    In the example search, "Hewlett Packard Japan", you can see that because you specified a Trigger URL Pattern of "*", all of your search results have your Infobar application.

    [Note] Note

    The search results you see above might not match what you see on your screen, since the search index changes over time.

    The Infobar is expanded for the first three results, and left unexpanded for the rest. Because the first two results happen to reside in the Yahoo! Directory, they both have a Category. The second result is in fact a Japanese language page, so the Language is "japanese".

Now that you have completed the quickstart tutorial, you should read Chapter 2, Developer Guide, which explains all of the SearchMonkey screens in detail and provides more in-depth tutorials.

If you are a site owner, you should start planning how to make relevant data from your site accessible to third-party developers:

  1. Join the Yahoo! SearchMonkey Group for Site Owners . This group offers key resources and discussion forums for you to get information and support on how to expose data to SearchMonkey developers.

  2. Visualize the kinds of SearchMonkey applications you might build for your site. What is the best way to represent your site’s structured information on the Yahoo! Search results page? Think about the kinds of images, deep links, and useful data you would like to present. For more information, refer to “Presentation Application PHP Structure” and “Presentation Application Best Practices”.

  3. Read Chapter 3, Site Owner Guide to learn more about how to mark up structured data on your site and generate feeds for SearchMonkey to consume.