Tuesday, November 28, 2006

Integrated Google AJAX Search with LEAD Portal

First I created a LEAD Project custom search engine:


Then I signed up for a Google AJAX search key for portal-dev.leadproject.org. Google gave me some stuff to add, and it worked just fine. I set the web search site restriction to the custom search engine created above:

var searchOptions = new GsearcherOptions();

var leadWebSearch = new GwebSearch();
searchControl.addSearcher(leadWebSearch, searchOptions);

This all worked fairly well, but I wanted a couple of other things from it. First I wanted to have the search control open up the results over the web page instead of within the web page and rearranging the layout. I found this blog entry at www.cjmillisock.com with a nice use of some simple CSS to get the right effect. Secondly, by default the search results are limited to just one. So I created a GsearcherOptions object with expanded mode set to OPEN (see the above code snippet and also the api documentation).

You can see the result at http://portal-dev.leadproject.org

No comments: