I have added a Google AJAX Custom Site Search to my website
http://www.appetere.com. This works normally, except that I cannot
get it to default to "more results" or "all results".
I have set the result set size using:
searchControl.setResultSetSize(google.search.Search.LARGE_RESULTSET);
and when I debug, the corresponding property is set to "large". But
it still only displays one result initially. Any ideas on what to try
next gratefully received.
The code extract below is on the Master Page of an ASP.NET V2.0 web-
site, so that the search box is displayed on all pages of the site.
<head runat="server">
<title>Appetere</title>
<link rel="shortcut icon" href="http://www.appetere.com/
favicon.ico" type="image/x-icon" />
<link href="http://www.google.com/uds/css/gsearch.css" type="text/
css" rel="stylesheet"/>
<!--This script includes the basic Google AJAX API's for search,
maps, etc
You then load the particular API you want to use with
google.load
-->
<script src="http://www.google.com/jsapi?key=myKeyGoesHere"
type="text/javascript"></script>
<script type="text/javascript">
//Tells compiler this is character data, not markup:
//<![CDATA[
//Loads version 1 of the Google search API
google.load('search', '1',{"nocss" : true});
//Sets the handler function to call once the document is loaded
google.setOnLoadCallback(OnLoad, true);
function OnLoad()
{
// Create a search control
var searchControl = new google.search.SearchControl();
// site restricted web search using a custom search engine
siteSearch = new google.search.WebSearch();
siteSearch.setUserDefinedLabel("Results:");
siteSearch.setSiteRestriction("myCustomSiteSearchKeyGoesHere");
searchControl.addSearcher(siteSearch);
//One web-post says this should be after addSearcher, which
resets set size
searchControl.setResultSetSize(google.search.Search.LARGE_RESULTSET);
// tell the searcher to draw itself and tell it where to attach
searchControl.draw(document.getElementById("searchcontrol"));
}
//]]>
</script>
<asp:ContentPlaceHolder ID="Head" runat="server">
</asp:ContentPlaceHolder>
</head>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Google AJAX API" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/Google-AJAX-Search-API?hl=en
-~----------~----~----~----~------~----~------~--~---