Wednesday 26 October 2011

Display a Web Part as a Visual Best Bet in FAST Search Server 2010 for SharePoint



FAST Search Server 2010 for SharePoint has a number of nice visual enhancements you don’t get with regular SharePoint Server Search, such as document previews and visual best bets. This blog post provides a walkthrough of making use of Visual Best Bets to display a SharePoint Web Part.


How do Visual Best Bets work?


MOSS 2007 and SharePoint Server 2010 provide Best Bet functionality that lets you specify some HTML to display as a Best Bet. A FS4SP Visual Best Bet on the other hand lets you specify a URL, the web page for the URL is then displayed in a web part using an iFrame.


If I setup a Visual Best Bet for the keyword “SharePoint” and specify a document library as a Visual Best Bet I get this:



The document library displays in an iFrame above the search results. If we edit the page you can identify the web part that displays the Visual Best Bet.




There’s one useful property you can edit for the ‘Search Visual Best Bet’ web part. The very first web part property displayed for the web part is called iFrame Height.






The default for this is set to 150 pixels. You can edit this property to allow you to display your Visual Best Bet with a higher height, as an example if I increase this to 300, I get the following.




So that’s how Visual Best Bets work… so I’ve been thinking of the best way to make use of Visual Best Bets to display some truly awesome looking dynamic content.


Well SharePoint can display dynamic visually rich content can’t it?


Here’s a page displaying a video using the Media Web Part.






Here’s a page displaying an Indicator Details web part for a KPI in a status list.





Here’s a page with a chart web part.

Wouldn’t it be nice if we could display Web Parts as Visual Best Bets?


If we try that, if I create a keyword for “FAST Search” and use the video page as a Visual Best Bet I get this:



 The page chrome, ribbon, banner, navigation etc. is getting in the way – wouldn’t it be nice if we could just display the Media Web Part as a best bet?


This is possible in SharePoint, you can selectively hide what is rendered on a page using CSS. A quick way to remove a large amount of page chrome is to use the IsDlg=1 query string parameter. So where my Video Page URL is:


http://portal.sezai.com/Pages/FAST-Search-Video.aspx


If I edit the Visual Best Bet, and change the URL to this:


http://portal.sezai.com/Pages/FAST-Search-Video.aspx?IsDlg=1  



I get the following in search results:



Much better! IsDlg=1 is used by SharePoint when displaying popup dialogs, the query string parameter hides page chrome. We still have an issue regarding not all content being displayed. There are two options with this:


1) Reduce the web part height in the video page.


2) Increase the height of the iFrame for the Visual Best Bets Web Part in the search results page.


Both will work, If I go with option 2 – I get this:



That looks sweet, it is displaying an inactive scroll bar… but let’s just ignore that :)


If we do the same with the KPI Web Part page we get:




Here’s what the chart web part looks like:



So you can quite easily setup Visual Best Bets with FAST Search Server 2010 for SharePoint to show a visually stunning Web Part if you:


1. Create a page and add your desired web part to it.

2. Ensure the web part height is less than the Visual Best Bets web part height, by either reducing the height of the web part you want to display, of increasing the iFrame Height property on the Visual Best Bet web part on the search results page.

3. Create a Visual Best Bet to your web part page and add the ?IsDlg=1 query string parameter to the end of the URL.

With all of the various types of dynamic web parts you get with SharePoint, you now have no excuse for not making good use of Visual Best Bets in FAST Search Server 2010 for SharePoint.

No comments: