July 11, 2007
We just launched a Google Search widget for Blogger built using the AJAX Search
API. For more information, see the Blogger In Draft Post.
One cool feature of the widget is the 'Linked From Here' feature that searches the pages you've linked to from your blog posts. If you are not using Blogger but use the AJAX Search API, you can still create something similar for your website using Linked Custom Search Engines.
To add this to your site simply use the .setSiteRestriction method in the AJAX Search API as you would to add a normal CSE restriction. For the site argument, use the URL of your website and the following tool to create a CSE specification. You can then pass it into the .setSiteRestriction method, as shown below:
var customSearch = new GwebSearch();
var extractLinks = "http://YOUR_SITE_HERE.com";
crefUrl : "http://www.google.com/cse/tools/makecse?url=" + encodeURIComponent(extractLinks)
If you already have a CSE specification, simply pass in the address of your CSE specification as the argument. See this sample for more details.