>Today I’ve been playing around with IE Search Providers. The search provider functionality has been enhanced since IE7’s release.
The search box lives in the top right hand corner and Microsoft have provided a means for websites to create custom search providers. All the major search engines have them now, just take a look here http://www.microsoft.com/windows/ie/searchguide/en-uk/default.mspx?dcsref=http://runonce.msn.com/runonce2.aspx.
With this link you can create your own.
So that got me thinking and after a quick search other people have already done, as these things go when I follow peoples instructions it never works quite right. So here I will document what I did and the problems that I overcame.
So first of all how do you setup the search provider, the search provider functionality is created from an xml file which follows the OpenSearch schema. This xml file is used by a javascript function AddSearchProvider, which is part of the IE object model. The xml file describes the search provider and as you can see below has additional meta data to allow you to describe the search provider.
An example of the xml file is as follows:-
<?xml version="1.0" encoding="UTF-8" ?>
<opensearchdescription xmlns="http://a9.com/-/spec/opensearch/1.1/">
<shortname>iThink Search>/shortname>
<description>iThink Search provider</description>
<inputencoding>UTF-8</inputencoding>
<url type="text/html" template="http://sharepoint/SearchCenter/Pages/Results.aspx?k={searchTerms}&s=All%20Sites" />
</opensearchdescription>
In order to install the search provider we need to provide a piece of functionality to allow users to install the provider automatically.
This functionality is provided using a content editor web part.
So add a content editor web part to a page, create and upload an xml file based on the file above. A few notable points are regarding the URL tag, make sure that sharepoint is changed to your SharePoint’s server name, dns entry. The & should be an & as opposed to &. If it isnt then you will get an error when a user tries to add the search provider through javascript.
Also the xml file should be saved as ANSI, you can do this in the save as options for notepad. If not you will get a search provider couldnt be added error.
So what I did was upload the xml file into the top-level sites “Document” document library.
Going back to the content editor web part that was added earlier, edit the page and from the web part menu do edit->modify shared web part settings, click on the source editor button and copy and paste the following:-
<a href="#" onclick="window.external.AddSearchProvider('/Documents/searchprovider.xml')">Add SharePoint search to IE.</a>
Make sure you update the AddSearchProvider function call so that searchprovider.xml is the right name and maybe update the link text.
Click Apply down the bottom of the web part properties and then test out the link. If you get an error load the xml again and make sure that the double quotes etc are correct.
Hopefully now it should have added the search provider into IE. Test out the search function and make sure that it works…
Done! You now have the ability to search your SharePoint sites + any other content you are indexing from IE and it doesnt matter if you are logged into the site or not!
Superb!
Good luck….