Introduction
Windows 7 introduces support for search federation to remote data stores using OpenSearch technologies that enable users to access and interact with their remote data from within Windows Explorer.
This document describes how to build a web-based data source that can be searched using Windows federated search. Following the best practices described here, you can enable rich integration of your remote data sources with Windows Explorer without having to write or deploy any Windows client-side code.
Search Engine Autodiscovery
Autodiscovery is a means for automatically finding machine-processable resources associated with a particular web page. The discovery can be automated because the resource is linked to in a well-defined way.
At time I had initially wrote this article, all prominant browsers (IE8, Chrome, and Firefox) openly supported search engine autodiscovery of those endpoints that OpenSearch compliant. However, since then only Firefox still easy provides the ability to add an OpenSearch provider; with Chrome you have to go through their Settings / Manager Search, and IE9 dropped it completely.
Here are some great articles about setting up specific browsers for Search Engine Autodiscovery:
For the best experience of OpenSearch, choose Firefox because it gives you the easiest possibility to add an OpenSearch engine to your browser.
Deployed Example:
http://www.jeff00seattle.com/projects/WindowsFederatedSearch4PHP/
What is Windows Federated Search?
Windows Federated Search enables users to search remote data sources from within Windows Explorer. Remote data sources make themselves searchable with a simple web front end that exposes their search capabilities.
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, with the right application icons and context menus.
Complete explanation if found here on Microsoft site: Federated Search in Windows
Windows Federated Search Sample Setup
The OpenSearch sample demonstrates how a PHP based web-site can expose its search via an OpenSearch endpoint and optionally provide a search filter within Windows Explorer to search the site. For the sake of simplicity, in this sample the OpenSearch endpoint on the PHP web-site simply uses the Yahoo Stock Quote service to get results. In a real-world scenario, the Search endpoint would likely invoke the web-site's internal search functionality.
There are five simple steps to getting Windows Federated Search Web Service endpoint demo to be accessible by Windows 7 Explorer's Federated Search functionality as shown in the figure below.
- Install Windows Federated Search Demo Endpoint folder WindowsFederatedSearch4PHP into a web service.
- For data source to access information beyond a firewall, then it may be necessary to modify proxy settings within WindowsFederatedSearch_UserConfig.class.php.
- Test RSS feed from Windows Federated Search Endpoint within a browser.
- Modify with URL path in Windows Federated Search Description document WindowsFederatedSearch4PHP.osdx.
- Deploy OSD document WindowsFederatedSearch4PHP.osdx to create a Search Connector within a client's Windows 7 Explorer
Step 1 - Create Windows Federated Search Web Service Endpoint - Install Demo Folder
Place folder WindowsFederatedSearch4PHP with all of its contents into your website.
By default, all required configuration to get this demo to operate has placed folder WindowsFederatedSearch4PHP into the localhost's root directory, port 80, and no proxy is required to gain outside the firewall access; in other words the Windows Federated Search endpoint is accessible from browser at URL address of:
http://localhost/WindowsFederatedSearch4PHP/
Step 2 - Modify cURL Proxy Settings for Window Federated Search Web Service Endpoint
WindowsFederatedSearch_DataSource.class.php is an example data source used by this sample Window Federated Search Web Service Endpoint. This data source estabilishes a connection to an external stock quote provider, Yahoo Stock, using PHP cURL.
If a proxy is necessary for estabilishing an Internet connection through a firewall, then it may be necessary to modify proxy information within PHP file WindowsFederatedSearch_UserConfig.class.php.
If a proxy is not required to access a site, then this step can be skipped.
PHP – WindowsFederatedSearch_UserConfig.class.php
Modify Search Name and Server settings for WindowsFederatedSearch_DataSource Endpoint
class UserConfigConstants
{
const OPEN_SEARCH_SHORT_NAME = 'Windows Federated Search 4 PHP';
const OPEN_SEARCH_DESCRIPTION = 'Windows Federated Search for PHP Developers Demo';
const SERVER_NAME = 'localhost';
const SERVER_PORT = 80;
const SERVER_ENDPOINT_PROXY = 'itgproxy';
const SERVER_ENDPOINT_PROXY_PORT = '80';
}
Step 3 - Test Windows Federated Search Web Service Endpoint with Browser
As mentioned, Windows Federated Search requires an RSS-2 feed from OpenSearch Web service. The easiest way to verify that your OpenSearch Web service is operational is to perform a search request to its endpoint from a browser.
The easiest solution provided by demo is to open the Internet Explorer 8 browser to the root of WindowsFederatedSearch4PHP's URL path.
http://hostname:port/.../WindowsFederatedSearch4PHP/index.php
This will provide to the Internet Explorer 8 browser a OpenSearch Description (OSD) document, and will be visible within the search box at the upper right corner of this browser.
For example, if the WindowsFederatedSearch4PHP is installed on localhost:80, then the following link should work in acquiring a OpenSearch Description document directly to the Internet Explorer 8 browser:
http://localhost/WindowsFederatedSearch4PHP/index.php
Enter within this search box with "Windows Federated Search 4 PHP" selected these stock symbols MSFT SY BA, and everything is correctly setup the browser should list the most current stock quotes.
What is occurring is that "Windows Federated Search 4 PHP" selection is a reference to an OpenSearch endpoint URL, and the browser builds a query based upon the user's search terms provide. For this demo, the following URL path performs a search request of these stock quotes: MSFT SY BA
The default OpenSearch description will be using format=html and source=IE-SearchBox, as is presented within the image previously:
http://hostname:port/.../WindowsFederatedSearch4PHP/search.php?query=MSFT+SY+BA&format=html&src=IE-SearchBox&start=1&cnt=10
For Windows Federated Search, the OpenSearch result needs to be format=rss:
http://hostname:port/.../WindowsFederatedSearch4PHP/search.php?query=MSFT+SY+BA&format=rss
For example, if the WindowsFederatedSearch4PHP is installed on localhost:80, then the following link should work:
http://localhost/WindowsFederatedSearch4PHP/search.php?query=MSFT+SY+BA&format=rss
If RSS feed is operational, then the following feed should be appear within your browser:
Internet Explorer – Turn On Feed Read
If you are using Internet Explorer (IE) and you see the following raw RSS XML feed, this is then you will need to turn on within this browser the the ability to read this feed.
In IE browser's menu bar, select Tools > Internet Options, then Content tab. Within Content tab in its Feeds and Web Slices section, select Settings button.
Within Feed and Web Slice Settings panel in its Advanced section, check box next to Turn on feed reading view. Then re-open browser. It should render a styled RSS view as presented previously.
Step 4 - Modify OpenSearch Description Document - WindowsFederatedSearch4PHP.osdx
This step sets up demo's OpenSearch Description document WindowsFederatedSearch4PHP.osdx which is used to estabilish a Search Connector within Windows 7 Explorer.
If this setup location for WindowsFederatedSearch4PHP is at URL http://localhost/WindowsFederatedSearch4PHP/, then this step can be skipped.
Three modifications are required and all modifications should have the same path value. By default, all three of the following have a value of http://localhost/WindowsFederatedSearch4PHP/:
- URL type="application/rss+xml"
- URL type="text/html"
- Image
XML – WindowsFederatedSearch4PHP.osdx
Modify paths to OpenSearch Endpoints
="1.0"="UTF-8"
<OpenSearchDescription xmlns="http://a9.com/-/spec/opensearch/1.1/" >
<ShortName>WindowsFederatedSearch4PHP</ShortName>
<Description>Windows Federated Search For PHP Developers</Description>
<Url type="application/rss+xml" template="http://localhost/WindowsFederatedSearch4PHP/search.php?query={searchTerms}&format=rss&src=ms-ose&start={startIndex}&cnt={count}"/>
<Url type="text/html" template="http://localhost/WindowsFederatedSearch4PHP/search.php?query={searchTerms}"/>
<Image height="16" width="16" type="image/x-icon">http://localhost/WindowsFederatedSearch4PHP/favicon.ico</Image>
</OpenSearchDescription>
Step 5 - Install Windows Federated Search Description document
Within a Windows 7 client, double-click your Windows Federated Search Description (OSD) document (WindowsFederatedSearch4PHP.osdx) which will perform "Create Search Connector". This will add a new connection to your Windows Federated Search Web Service endpoint within "Search" box of client's Windows Explore.
Step 6 - Perform Search within Windows 7 Explorer
The following figure shows the Windows Federated Search results based upon a stock symbols search request within Windows 7 Explorer. Search box contains these symbols:
MSFT SY BA .
Helpful Tips
Internet Explorer Browsers that support OpenSearch
OpenSearch was introduced into the IE Search Box in IE-7 browser and was carried over into IE-8 browser. However, to much dismay and disgruntlement, OpenSearch functionality was dropped from IE-9.
Debugging OpenSearch Description OSDX
If at the start when providing OpenSearch site to be selected by IE Search Box to an IE-8 browser, and it is not recognized; then gather the generated OSDX by downloading the description.php via the browser:
http://.../WindowsFederatedSearch4PHP/description.php
The saved description.php file will contain the generated OSDX. Next, validate that the OpenSearch XML description is complete and without extra characters. For example, this is a valid OSDX content using by another OpenSearch site generated by its description.php:
<OpenSearchDescription
xmlns="http://a9.com/-/spec/opensearch/1.1/"
xmlns:referrer="http://a9.com/-/opensearch/extensions/referrer/1.0/"
xmlns:time="http://a9.com/-/opensearch/extensions/time/1.0/">
<ShortName>Windows Federated Search 4 PHP</ShortName>
<Description>Windows Federated Search for PHP Developers Demo</Description>
<Url type="text/html" template="http://www.jeff00seattle.com/Projects/WindowsFederatedSearch4PHP/search.php?query={searchTerms}&format=html&src={referrer:source?}&start={startIndex}&cnt={count}" />
<Image height="16" width="16">http://www.jeff00seattle.com/Projects/WindowsFederatedSearch4PHP/favicon.ico</Image>
<Language>*</Language>
</OpenSearchDescription>
History
- 2012 February 29 -- Updated WindowsFederatedSearch4PHP_1_0_0_6.zip
- 2012 February 29 -- Add new section Helpful Tips