Windows 7 Federated Search

Windows 7 Federated Search

  • Comments 1
  • Likes

Federated search enables users to search remote data sources from within Windows Explorer. This means that from within Windows Explorer, you can search those Web sites, feeds, and other structured remote data sources that make themselves searchable with a simple Web front end that exposes their search capabilities. You can use the search box in Windows Explorer just as you do when searching your own content. Search results are displayed in the same way, including coloring and even file preview. The results behave just as you would expect from items listed in Windows Explorer, as shown in the following image:

federated_Search_01

The benefit of integrating your data source with Windows Explorer is that users can get at all of their information by using the already familiar Windows Explorer user interface. Your users will be able to see files from your remote data source just as they would local files, including the right application icons and context menus. They can preview documents or Web pages, see thumbnails of images, and drag and drop a file directly to the desktop or into an e-mail. Please note in the above picture that the files are from flickr.com and I am still getting the size, name, tags, date modified, and so on.

In this post, based on the Windows 7 Federated Search Provider Implementer’s Guide, you learn what federated search is and how it works. If you are interested in using federated search or in creating your own search provider, please read this guide.

How does it work?

Windows 7 supports hooking up external sources to the Windows Client via the OpenSearch protocol. The OpenSearch v1.1 standard defines simple file formats that can be used to describe how a client should query the Web service for the data store and how the service should return results to be rendered by the client. Basically, this means that you can point Windows Explorer to an external data source. Using the standard OpenSearch protocol, Windows Explorer submits the search query and the remote data source returns a well-formatted data structure that can then be parsed and presented to the user.

To add a new OpenSearch provider, you need to “install” a Search Connector Description file (a .osdx file). The internal file format for a .osdx file is an OpenSearch Description XML document. Here is the content of a Flickr search osdx file:

<?xml version="1.0" encoding="UTF-8"?>
<OpenSearchDescription xmlns="http://a9.com/-/spec/opensearch/1.1/" 
   xmlns:ms-ose="http://schemas.microsoft.com/opensearchext/2009/">
  <ShortName>Flickr Search</ShortName>
  <Description>OpenSearch for Flickr via Windows 7 Search Federation.</Description>
  <Url type="text/html" 
   template="http://www.flickr.com/search/?w=all&amp;q={searchTerms}&amp;m=text"/>
</OpenSearchDescription>

Note how simple the file is. It basically includes a URL to Flickr search that specifies the searchTerms, which is the search query. For more information please go to OpenSearch v1.1 standard. Those of you who have a good eye and a good memory might think that the above XML looks a lot like an Internet Explorer 8 (IE8) Search Provider Extension – you know, the little search box on the top right of IE8 that lets you choose the context in which you execute a search. This is interesting enough so that you can expect a future post on how to convert an IE8 Search Provider to a Windows 7 Federated Search.

End users have several options for installing a new remote data source with Windows federated search: they can open a .osdx file by clicking on a link to one on a Web site or by opening one provided by someone else on a share or via an email attachment. This creates a .searchconnector-ms file in the Windows “Searches” folder (%userprofile%/Searches) and places a shortcut into the “Links” folder (%userprofile%/Links). This shortcut shows up in the Windows Explorer navigation pane Favorites section.

The communication between Windows Explorer and your OpenSearch Web service is done through the Windows Data Layer, which can communicate with various data source types via what are called Windows Store Providers. Each provider specializes in communicating with data stores that support a particular protocol and have specific capabilities. The OpenSearch provider communicates with data stores that have a Web service that supports the OpenSearch standard.

imageLet’s give it a try. Please click here to download (install) a Flickr search connector. You will be prompted to either save or open the file. Choose Open to actually register the search provider on your computer. Then, you will be prompted to Add a Search Connector. Accept by pressing the Add button as shown in the following image:

federated_Search_02Note that a new shortcut named Flickr Search is added to your Favorite’s navigation pane. Click that shortcut, and then type Seattle in the Windows Explorer search box. Wait few seconds as the results are being streamed from the Flickr Web site.

Behind the scenes, when the user types a term into the search box in the upper right hand of Windows Explorer, the query is sent to the OpenSearch provider (described in the .searchconnector-ms file), which then sends the query to the remote data store (the URL that contains the “searchTerms” in the osdx file). The remote Web service responds to the query with results in an XML document in either the RSS or Atom format. The OpenSearch provider parses the XML elements of the results into items which eventually make it back to Windows Explorer where they are displayed to the user. The following picture illustrates the flow of data:

imageThere are three steps to getting your data store’s Web service connected to Windows 7:

  1. Enable the data store to be searched from Windows using OpenSearch with RSS or Atom output.
  2. Create .osdx files that describe how to connect to the Web service and how to map any custom elements in your RSS or Atom XML.
  3. Deploy the search connectors to Windows client machines using the .osdx files.

 

The OpenSearch protocol gives you a lot of hooks into the system to customize the way results are displayed within Windows Explorer. For example you can:

  • Create a template for initial queries
  • Set the maximum results count and create pages
  • Customize the results view
  • Map properties to the Windows Explorer property system
  • Generate tooltips

There is a lot more to learn about how to create your own OpenSearch provider. If you are interested, read the Windows 7 Federated Search Provider Implementer’s Guide and view the Federated Search video created by Sasha Goldstein, one of the Introducing Windows 7 for Developers authors.

Get Microsoft Silverlight
1 Comments
You must be logged in to comment. Sign in or Join Now
  • someone
    156 Posts

    But you got standard local search all wrong. Hoping that the average user will remember the AQS or even try to remember it = epic FAIL. Please create a tool (maybe a powertoy) that exposes the full AQS so life will be easier for everyone. How does XP's Indexing service or even Windows Search 4 also have indexed search AND a GUI to conduct searches? The minimal UI in Windows 7 doesn't help me while searching at all. I am ended up switching to a third party search utility.