June 10, 2005
Update: June 20, 2005
For those of you who need assistance with installing this web part, you can use my Web Part Package Installer program. This installer program makes installing a web part package very easy.
I have provided two downloads.
I created a custom Google web part a few weeks ago for my demo SharePoint site. The Google web part submits a search request by navigating the user directly to the Google search web page and performs a Google search using the Google search engine. I have since received a number of emails requesting to get this web part for use on their SharePoint sites.First and foremost, the Google name and search service are the property of Google. I have no affiliation with the Google name and its services.
Google is a must-have resource for my daily work. If I need to find something, I Google it, and nothing else comes close when searching on the Internet. With this dependency, I had to have it on my new SharePoint demo site. My SharePoint demo site is more of a test-harness at this point since it is hosted on a shared/public server, so don’t be too disappointed when you see it.
For those of you not familiar with Google, welcome to the Internet. Google is the single best Internet search service available on the Internet, for the Internet. If you need to find something on the Internet, Google will find it for you. This process of searching is commonly referred to Googling. If you Google something, your are using Google to search the Internet for it. For the rest of you, Google is probably how you found this article.
It is important to remember that this Google Search web part is not intended to replace the SharePoint search feature. In order for Google to find any results, Google must have already searched and indexed your site. Also remember that Google will not be able to crawl and index pages on your SharePoint site that are not accessible to the public. This is where the SharePoint search has the upper hand. Again, this web part is not intended to replace the SharePoint search feature, but to conveniently access the much used Google search from your SharePoint page.
Configuring the Google Search Web Part
Here is a picture of the web part configurations.
Google Image URL
Once you have installed the web part, in the configuration options of the web part is a Google Image URL property which defaults to an image on Google’s web site. You should use the default url for the Google image. I have made this property available just in case Google renames or moves their image.
This Google Search Web Part can be configured in three distinct ways.
Standard Google Search
Local Site Search
Custom Site Search
Standard Google search
The standard search performs a normal Google search just as if you went to the Google web site and entered your search criteria.
Local Site Search (Using Google)
The local site check box is used to limit the Google search results to return only content that resides within the current site URL. The local site URL will be displayed in the Google Search Web Part to make this clear to the user. This allows the Google Web part to use the current site URL as the search scope. To be clear, the Google search engine is used to search for results for only those web pages that have the same domain as the current page.
Important Note: The Local Site check box may not stay checked. If this is the case, this is intentionally being unchecked by the web part when you save because the mechanism used to obtain the local site URL is not allowed due to the current security restrictions on SharePoint server. You will either need to have the server administrator grant the necessary access, or simply not use this option.
Custom Site URL (Using Google)
If you specify a custom URL, the custom URL is used to narrow the Google search results to return only the results that are located on the specified custom site/URL.
About the Downloads
The compiled assembly and web part package have been built with a strong name and therefore can be installed in the GAC if needed. This also allows for this assembly to be configured and used on SharePoint servers that have tighter security. If you are unable to compile, or simply wish to use my assembly, you can do so with the confidence knowing the full assembly name (including the version, public token, etc.) will only work with the compiled assembly I have provided in the web part package (.cab) file.
The source code is also available in a separate download; however, I have removed the Strong Name Key file to keep my compiled version secure from any bogus impersonators. You will need to create your own strong name key file and update the necessary manifest and web part description (.dwp) file to successfully deploy your web part assembly to your SharePoint server. For those who are interested in how this web part has been written, you can view the source, modify, and build your own Google Search Web Part.
How the Google Search Web Part works
This is a very simple web part. The entire Google search request is performed using the standard Google search URL along with a couple query string (URL) parameters.
The Google Search URL accepts a number of parameters. The only two we are concerned with are the search criteria and; optionally the site URL scope. The search criteria is appended to the URL with the “q=” parameter. Additionally, the “site=” parameter allows us to optionally narrow the scope the of the search results to the site URL provided.
Here is the base Google Search URL.
Here we have appended the search criteria to the URL.
Finally, we here we have the Google Search URL with the search criteria and the site scope added to the URL. This will only return results that meet my search criteria AND exist on the blogs.crsw.com/mark site.
This Google Search Web Part may be used – free. There is no implied warranty and you use it at your own risk. But how could you not.
Need Help Installing This Web Part?
If you need help installing this web part package, try using my Web Part Package Installer program to make this process easy.