This article presents the Windows 7 Federated Search Provider and how you can use.

I have created one for my blog which you might have noticed in my download area befor

e. Feel free to use it on your own Windows 7 PC to search my blog from there.  

The MSDN defines Windows 7 Federated Search Provider

Windows 7 introduces support for search federation to remote data stores using OpenSearch technologies. Federated search enables users to search remote data sources from within Windows Explorer and to interact with that remote data from within Windows Explorer.

Federated Search
Explorer Federated Search Pane

So what does it mean exactly you might ask?
It’s a nice way to search the content of the website while you work with Windows Explorer. So the good thing is you don’t have to open up any browser to browse  the site first while you are in the need to search something on it. All can be done within the Windows Explorer. I have created a small screenshot for you where you get an overview of what the search result will display.

 

In the next steps I will try to explain what is needed to create your own search connector while keeping it simple.

Components involved

  • An Opensearch compatible web service. (Most if not all wordpress blogs should be working fine here since they are creating rss / atom feeds which we need for the search connector to work correctly.) Well if your site isn’t compatible with Opensearch v1.1 standard I will show you later a neat trick so you will be able to create your search connector too.
  • osdxicoThe osdx file which is basically a simple xml file used to describe your web service.

Connecting to Your Web Service from Windows

I will not go into detail here since the Windows 7 Federated Search Provider Implementer’s Guide can be downloaded directly from Microsoft itself where you get a much deeper view of all parameters involved.

I mentioned above which components we need to have to let Windows add a search connector (this is really simple you just need to double click your Search Connector Description file (.osdx) within Windows.

Creating the Search Connector Description file

So it’s time to open up your favorite xml editor (I use notepad++ for this).
But wait some importent things to know about OpenSearch Description files:

  • MUST be a valid OpenSearch Description document, following the OpenSearch 1.1 specification.
  • MUST provide a URL template with either an RSS or an Atom format type.
  • MUST use the .OSDX file extension, or when downloading from the web, the application/opensearchdescription+xml MIME content type MUST be associated with it.
  • Should provide a “ShortName” value.

Example OSD file

The following sample describing the parameters is the one I created for my own blog. You can simply adapt it later to use the same osdx file for your own site / blog.

<?xml version="1.0" encoding="UTF-8"?><OpenSearchDescription xmlns="http://a9.com/-/spec/opensearch/1.1/"> <ShortName>private-storm</ShortName><Description>private-storm - For Delphi Developers</Description><Url type="application/rss+xml" template="http://www.private-storm.de/index.php?feed=rss2&amp;s={searchTerms}"/></OpenSearchDescription>

Standard Elements to Include

<Shortname>

The ShortName element value is used by Windows to name the .searchconnector-ms file that’s created when the user opens the .osdx. Windows ensures that the created file name uses only characters allowed in Windows file names.

If no ShortName is provided, the .searchconnector-ms file will attempt to use the file name of the .osdx file instead.

<Url>

The OSD file must include one URL template that returns results in either RSS or Atom format. The “type” attribute must be set to “application/rss+xml” for RSS formatted results or “application/atom+xml” for Atom formatted results.

Thats all, just change the Shortname, Description and Url Template to your needs and you are ready to go.

Additional Elements

Token Supported How it’s used by the OpenSearch provider
{searchTerms} Replaced with the search terms the user types in the Windows Explorer search input box
{startIndex} Used when getting results in “pages.” Replaced with the index for the first result item to return.
{startPage} Used when getting results in “pages.” Replaced with the page number of the set of search results to return.
{count} Used when getting results in “pages.” Replaced with the number of search results per page that Windows Explorer is asking for.
{language} Replaced with a string that indicates the language of the query being sent.
{inputEncoding} Replaced with a string (such as “UTF-16”) that indicates the character encoding of the query being sent.
{outputEncoding} Replaced with a string (such as “UTF-16”) that indicates the desired character encoding for the response from the web service.

As mentioned earlier in this article if your site isn’t compatible with Opensearch v1.1 standard we can make it work with a trick. Its really simple we just create our .osdx file as mentioned above but we route the search terms over to an alternate search engine e.g. google or bing or live (see the example below) which are compatible with opensearch and will produce the needed rss / atom feeds for you.

<?xml version="1.0" encoding="UTF-8"?><OpenSearchDescription xmlns="http://a9.com/-/spec/opensearch/1.1/"> <ShortName>private-storm</ShortName><Description>private-storm - For Delphi Developers</Description><Url type="application/rss+xml" template="http://search.live.com/results.aspx?q={searchTerms}+site%3http://www.private-storm.de&amp;count=50&amp;format=rss"/></OpenSearchDescription>