Connecting Your Web Service in Windows Federated Search
[This documentation is preliminary and is subject to change.]
This topic describes the steps involved in connecting a Web service between your data store and Windows federated search, and how to send queries and return search results in RSS or Atom.
This topic contains the following sections:
- Register a Remote Data Store
- Send Queries and Return Search Results in RSS or Atom
- Example of an RSS Feed Output
- Guidelines for Creating RSS output
- Additional Resources
- Related Topics
Register a Remote Data Store
A user registers a new remote data store with Windows Federated Search by opening an OpenSearch Description (.osdx) file. When the user does so, the following events occur:
- A .searchconnector-ms file (search connector) is created in the Windows Searches folder (%userprofile%/Searches).
- A shortcut to the .searchconnector-ms file is created in the Links folder (%userprofile%/Links).
- A shortcut appears in the Windows Explorer navigation Favorites pane, enabling the user to navigate into the new data store, and query the Web service.
Note A data store that already has an OpenSearch Web service that is compatible with Windows federated search can be added to Windows Explorer when users open an .osdx file.
Send Queries and Return Search Results in RSS or Atom
When the user types a term into the search box in the upper right corner of Windows Explorer, the query is sent to the OpenSearch provider, which then sends the query to the remote data store. The remote Web service responds to the query with results in an XML document in one of two supported formats (RSS or Atom), and typically referred to as a feed. Each result item in the feed includes XML child elements to represent or describe item metadata, such as the title, URL, description, thumbnail picture and so forth. The OpenSearch provider is responsible for mapping the XML element values to Windows Shell System properties that can be used by Windows applications.
Example of an RSS Feed Output
The following sample RSS feed output returns one item.
<rss version="2.0" xmlns:media="http://search.yahoo.com/mrss/" xmlns:example="http://example.com/namespace"> <channel> <title>Search Results</title> <item> <title>An example result</title> <link>http://example.com/pictures.aspx?id=01</link> <description>This is a test of the emergency search results system. If this were a real emergency result, you'd be reading something more useful.</description> <pubDate>Wed, 1 Oct 2008 23:12:00 GMT</pubDate> <media:content url="http://example.com/pictures/picture01.jpg" fileSize="212889" type="image/jpeg" height="768" width="1024"/> <media:thumbnail url="http://example.com/thumbnails/picture01.jpg" height="120" width="160"/> <example:dateTaken>Mon, 22 Sep 2008 23:12:00 GMT</example:dateTaken> </item> </channel> </rss>
Guidelines for Creating RSS output
Follow these guidelines for creating RSS output:
- Each item MUST return a
enclosurevalue (or equivalent, such as
- Do not include any HTML formatting tags in the
titleattribute, or those tags will appear in the title, and be displayed in Microsoft Windows Explorer.
- For the
- Show enough information so that the user knows why this result might be relevant
- Do not include HTML formatting. The OpenSearch provider removes the formatting, which might result in less than desirable results for your description.>
- Do not include metadata that is already provided in other elements such as enclosure file name, size, modified date, and so forth, because Windows Explorer already displays the metadata. Doing so in
descriptionelement would be redundant.
- For enclosure or content URLs:
- The type attribute must be specified.
- The type attribute must be a valid MIME type.
- The file size must be specified in bytes.
- If you are implementing this RSS output in .NET using DateTime, then test your feed in Internet Explorer to see if it is valid, before deploying to Windows Explorer.
- For a demonstration of how to create an OpenSearch Web service for a SQL database, see the Windows 7: Empower Users to Find, Visualize and Organize their Data with Libraries and the Explorer video presentation given at PDC (October 2008).
- For information on Windows system-defined properties, see System-Defined Properties for Custom File Formats.
- For information on Shell system properties, see System Properties.
- SharePoint Search Server 2008 and MOSS 2007 SP2 also support federated search of remote servers using OpenSearch. For more information about federated search and Search Server 2008 deployment with Office SharePoint Server 2007, see Welcome to Microsoft Search Server 2008.
- See the Microsoft Download Center Web site for the following downloadable resources:
- Windows 7 Federated Search Provider Implementer's Guide.
- Search Server 2008 Sample: Federated Search Connector Sample.
- For more information about the OpenSearch standard, see the OpenSearch Web site.