I have a problem with the Google search (insite search) implemented on one of our clients site (
www.morrisfoundation.in)
We have hosted this site on godaddy server. The issue which we are facing is as below:
The Google custom search (insite search) we have implemented on the website returns no results every time or any time on any keyword search on the site. The keywords which you could use for your reference could be like - ADD, Morris, Training program, etc.
I have use the following code..
<script type="text/javascript"
src="http://www.google.com/uds/api?file=uds.js&v=1.0&key=ABQIAAAAsAzZfunLIuitazLi7gywyhQwHkkBoUQGHi5pswjo0-XzJ3Td0RTBhkZRvX_LHHu8TYKWpoQPhdeuMg">
</script>
<script language="Javascript" type="text/javascript">
//<![CDATA[
google.load("search", "1");
function OnLoad() {
// Create a search control
var searchControl = new GSearchControl();
searchControl.setResultSetSize(GSearch.LARGE_RESULTSET);
// site restricted web search with custom label
// and class suffix
var options = new GsearcherOptions();
var siteSearch = new GwebSearch();
siteSearch.setUserDefinedLabel("Search results for Morrisfoundation");
siteSearch.setUserDefinedClassSuffix("siteSearch");
siteSearch.setSiteRestriction("morrisfoundation.in");
searchControl.addSearcher(siteSearch, options);
options.setExpandMode(GSearchControl.EXPAND_MODE_OPEN);
//to get the id from querystring
//Server.UrlDecode(Convert.ToString(Request.QueryString["Search"]))
var tabvalue = getQueryVariable("Search");
tabvalue=tabvalue.replace(/%20/g," ");
document.getElementById("searchcontrol").value=tabvalue;
searchControl.draw(document.getElementById("searchcontrol"));
// Execute an inital search
searchControl.execute(document.getElementById("searchcontrol").value);
}
google.setOnLoadCallback(OnLoad);
function getQueryVariable(variable)
{
var query = window.location.search.substring(1);
//var vars = query.split("&");
var vars = query.split(" ");
for (var i=0;i<vars.length;i++)
{
var pair = vars[i].split("=");
if (pair[0] == variable)
{
return pair[1];
}
}
}
//]]>
</script>
Could you please help on above mentioned problem ASAP