Introduction

This solution helps to view SharePoint search results along with Google results within a SharePoint portal.

using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Text;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
publicpartialclass SharepointGoogleSearchIntegration : System.Web.UI.UserControl
{
#region PageLoad
///<summary>/// This is an aspx page,hosted in SharePoint
/// which renders the search results depending
/// on the query string passed from the SharePoint WebPart.
///</summary>///<paramname="sender"></param>///<paramname="e"></param>protectedvoid Page_Load(object sender, EventArgs e)
{
///Here the query string is fetched & is passed to a hidden varible , which in turn
///passes the value to the Google-API to fetch the corresponding search results.
//Since Sharepoint uses K as the querystring parameter , due to which we have used
// K as the Query String parameter , so that same query is used for Portal Search
//along with With Search
if ((Request.QueryString["k"] != null) &&
((Request.QueryString["k"] != "")))
{
//This is the hidden field which is used as a container for the value
//fetched from the query string .
hdnField.Value = Request.QueryString["k"].ToString();
hdnField.EnableViewState = true;
}
InitalizeScripts();
}
#endregion///<summary>/// This method is used to pass the server side value to the
/// client side variable
///</summary>protectedvoid InitalizeScripts()
{
String sb = string.Empty;
// Underneath is the JavaScript which is truncated here & will be
// visible when you will download the article.
sb = "<script type='text/javascript' language="'javascript'">"
+ "function LoadValues()"
+ "{"
+ "var hiddenval = '" + hdnField.Value + "';"
+ "return hiddenval;"
+ "}"
+"</script>";
Page.RegisterClientScriptBlock("ClientScript", sb.ToString());
}
}

SharePoint - Google - Search Integration allows the user to view the web results within the SharePoint portal. The user doesn't need to specify the text separately into two search controls. The default SharePoint Search WebPart is used to pass the query to other WebParts which produce the web results at the same time.

In case of any queries, you can revert to me at "pankaj.pahuja@gmail.com" or "pankaj_proteans@hotamil.com".

I think the name of the hidden field used in CS file is different from the one in ascx , make sure the name of the hidden field is same both in the ascx & the cs files.Let me know if you still have any issues

Prerequisite - Make sure you have the SmarPart installed on your machine .
Create a UserControl folder under a webapplication . Under that folder place both these files. Go to that webapplication & drag & drop this usercontrol using smart part on the Sharepoint Search results.aspx.