共用方式為


Federated Search HTML to RSS Connector Sample

By using federation in Microsoft Search Server, you can include search results from any searchable XML feed (such as RSS or Atom). Microsoft Search Server sends an OpenSearch query to the source feed, receives XML results in return, and displays these results in a Federated Results Web Part. To search a source that does not expose an XML feed (for example, databases and HTML pages), you must create a lightweight interface that exposes the location as an XML feed.

For HTML pages, the interface converts the HTML of the page into a structured XML feed (such as RSS or Atom). Then you create a new OpenSearch location that uses the feed exposed by your interface. You can either locate this application on another site or put it in the _layouts folder for the Search Server site. For more information about how and when to create this type of application, see Architecture Guidance for Building Federated Search Connectors [Search Server 2008].

This sample shows you how to implement and deploy a federated search connector that converts HTML to an RSS feed. As an example, the article describes how to convert the HTML of Live Search results into an RSS feed. This sample must be modified to work with results from any other location. Other search sites will return different HTML, which this sample will not parse correctly, and they might have special requirements for accessing their results (for example, authentication requirements). Because Live Search already provides an RSS feed, this sample is educational for that location. You do not have to convert HTML into an RSS or ATOM feed to access results from Live Search.

Note

Some sites might object to using their search results in this manner. You must check a site's Terms of Use, and, if necessary, check with the site's owners, to determine whether remote access in this manner is an authorized use of its services and data. If it is not authorized, you cannot use this sample or this approach to display their results.

For the download, which includes the complete code for the Federated Search HTML to RSS Connector sample application, see HTML to RSS Federated Search Connector.

Prerequisites

To use the Federated Search HTML to RSS Connector sample, your environment must have the following installed:

  • Microsoft Search Server 2008

  • Microsoft Visual Studio 2005 with Microsoft Visual C# enabled

Completing the walkthrough

The following topics walk you through creating and deploying a federated search HTML to RSS connector:

Step 1: Set Up the Project for the Federated Search HTML to RSS Converter [Search Server 2008]

Step 2: Add the Code for the Federated Search HTML to RSS Converter [Search Server 2008]

Step 3: Create the Federated Search Location and Customize the XSL [Search Server 2008]

See Also

Concepts

Architecture Guidance for Building Federated Search Connectors [Search Server 2008]
Federated Results Web Parts XSLT [Search Server 2008]