Step 3: Create the Virtual Earth Map Location and Customize the XSL
Note
This topic describes functionality that is part of the Infrastructure Update for Microsoft Office Servers. To download the update, see Description of the SharePoint Server 2007 infrastructure update: July 15, 2008.
After you verify that the HTML to RSS federated connector is working (see Step 2: Add the Code for the Federated Search Virtual Earth Map Connector ), you need to create a federated location for it. You can then add a Federated Results Web Part that displays results from the location. The tasks involved include:
Creating the Federated location
Customizing the Federated location's XSL property
Adding the Federated Results Web Part
Testing the Federated Search Virtual Earth Map Connector
To create the federated location
On the Search administration page of your Office SharePoint Server 2007 Shared Services Provider, click Federated Locations, and then click New Location.
In the Location Name field and Display Name field, type the names you want to use for the location, and the text you want it to display as its name..
In the Description field, type text to describe the location, such as Live Search Results.
In the Version field, type 1.0.
For the Location type field, click OpenSearch 1.0/1.1.
In the Query Template field, type the URL for the RSS feed you created (for example, https://localhost/Default.aspx?q={searchTerms}
)
.In the "More Results" Link Template field, type http:// search.live.com/results.aspx?q={searchTerms}.
Click OK.
To customize the XSL property of the federated location
On the Search Administration page, click Federated Locations.
Under Location Display Name, click the name of your location.
Expand the Display Information node.
Under Federated Search Results Metadata, clear the Use Default Formatting check box.
Click the ellipsis (…) button to open the Text Entry window for the location'sXSL property.
Add this script under the
<xsl:call-template name="MainTemplate.description">
section (directly under that section's</xsl:call-template>
closing tag).<script type="text/javascript" language="javascript" > <xsl:text disable-output-escaping="yes"> <![CDATA[ <!-- document.write('<script type="text/javascript" language="javascript" src="http://dev.virtualearth.net/mapcontrol/mapcontrol.ashx?v=6"></script>'); //--> ]]> </xsl:text> var map = null; // Set page event handlers for onload and unload if (window.attachEvent) { window.attachEvent("onload", Page_Load); window.attachEvent("onunload", Page_Unload); } else { window.addEventListener("DOMContentLoaded", Page_Load, false); window.addEventListener("unload", Page_Unload, false); } // Load map function Page_Load() { GetMap(); } // Clean up all objects function Page_Unload() { if (map!=null) { map.Dispose(); map = null; } } //Pass the latitude and longitude values from the RSS feed to Virtual Earth function GetMap() { map = new VEMap('FedMapDiv'); map.SetDashboardSize(VEDashboardSize.Small); map.LoadMap(new VELatLong(<xsl:value-of select="latitude"/>,<xsl:value-of select="longitude"/>), 10, 'r', false); var mapdiv = document.getElementById("FedMapDiv"); var yPos = mapdiv.clientHeight - 195; var location = new VELatLong(<xsl:value-of select="latitude"/>,<xsl:value-of select="longitude"/>); var shape = new VEShape(VEShapeType.Pushpin, location); map.AddShape(shape); map.SetCenterAndZoom(location, 12); } </script> <div id='FedMapDiv' style="position:relative; width:300px; height:300px;"> </div>
Click OK to close the Text Entry window.
On the Edit Federated Location page, click OK to save the changes to the federated location.
To add the Federated Results Web Part to your Office SharePoint Server 2007 site
From the Search Center, go to the search results page in the path
http://YourServerName/results.aspx
.Click Site Actions, and then click Edit Page.
In the Right Zone, click Add a Web Part.
In Suggested Parts for Right Zone, select Federated Results, and then click Add.
Click Edit for the new Federated Results Web Part, and then click Modify Shared Web Part.
In Location Properties, click the name of the location that you created from the Location list.
In Display Properties, ensure that the Retrieve Results Asynchronously check box is cleared. The Web Part must load synchronously for the ECMAScript (JScript, JavaScript) in the XSL property to work correctly.
Click OK.
Click Exit Edit Mode to close the Edit page.
To test the HTML to RSS Federated Connector
Go to the Search Center Home page in the path
http://
YourServerName/default.aspx
.Type a valid address, consisting of street address, city, and state, in the search box.
If the Federated Search Virtual Earth Map Connector is working, you should see an interactive Virtual Earth map on the search results page.
See Also
Concepts
Step 1: Set Up the Project for the Federated Search Virtual Earth Map Connector
Step 2: Add the Code for the Federated Search Virtual Earth Map Connector