How to make Search Results Actionable

This question from your clients will always come up. You have just integrated their LOB system into SharePoint Search and now you are having results show up. Those results are nothing more than a set of property values that were crawled earlier and now your clients want to be able to actually interact with them. The first question to ask is what level of interaction are they looking for. Here are the different levels:

  1. Launch a client application to open and work with the item.
  2. Go to a details page on your portal with more data about the item and that has more links to work with the item.
  3. Provide a contextual menu on each item that lets you act directly on that item. Open/Edit/Check-In/ Check-Out. These menu clicks will need to go to somewhere and provide the desired functionality. 

As I stated above your search results are just crawled property values with no magic solution built in for working with the results (unless they are crawls of standard portal content sources, but we are talking about all the other LOB systems out there). By default one of the properties that gets crawled is the link or HREF, and this is what will be the link that you get served. If you are using a vendor provided integration then the integration may be taken care of for you. Some vendors create a central site under _layouts which serves as the target for all their items they index.

But let's focus on a custom integration for now. You have just written a neat protocol handler (http://sharepointsearch.com/cs/blogs/notorioustech/archive/2007/06/19/contentenumerator-cs-for-stored-procedure-sample.aspx) or created a BDC definition (http://blah.winsmarts.com/2007-4-SharePoint_2007__BDC_-_Enabling_Search_on_business_data.aspx) to index content from some system.  In either case you have to decide what you are going to put in for a hyperlink property for this item.

Note: you CAN"T put javascript as SP Search will URL Encode it for you and that will break it. 

Here are some helper ideas on what to actually do to make your results super actionable.

1. Create a destination page like customer.aspx  and use the BDC web parts to display a detail view of the search item. Have the id of the item be passed in as a parameter to that customer.aspx and the web parts filter on it. NOTE: The profile page will be the default for BDC items that were indexed by SharePoint search, but I am talking about a custom destination page. 

2. If you or a vendor has already developed a web based integration whether SharePoint enabled or not, you can alter the search results xslt to pop open a window to that application passing in the id of the item.

3. If you are good with xslt you can edit the results web part to check for your content type and provide the users with more options than a simple single link. I have created menus on the fly based on both the content source and also individual crawled properties of that item. For instance: You can have a property that says whether an item is readonly or not and provide a link to edit/check out.  Ontolica provides you with many tools to customize your results without resorting to xslt editing, including the adding of menu actions based on crawl property values.

4. Client Side Integration - This is for experts only.  Microsoft uses activex controls to launch office applications from sharepoint http://blogs.technet.com/josebda/archive/2007/03/26/searching-the-visible-moss-2007-code-for-activex-references.aspx  and so can you for your own applications.  I will try and whip up a sample, but here is a freeware link http://www.whirlywiryweb.com/q/launchinie.asp for now. So what you do is write some custom xslt to replace the standard href of your content with javascript calls to an embedded activex control on the search results page to launch your client application for your item. I said it was for experts :).

5. Citrix Side integration - Now this is really really tricky. If you are running a citrix server and can host applications there, you can use the newly released WISP SharePoint product from Citrix to actually launch applications from your portal as in #4 above but they don't need to reside on your client. This is not standard public functionality and it took a lot of poking around with reflection to figure out how to trick it to open items that aren't actually stored in the portal, but it works for Hummingbird, Worksite, etc. pretty much every LOB application out there.  I would post specifics about this but unfortunately I have to keep some trade secrets for my company. If you have gotten all the way through all of the above and this is a model you are interested in, contact me directly.

Del.icio.us | Digg It | Technorati | Blinklist | Furl | reddit | DotNetKicks
Published 27 August 2007 03:22 AM by notorioustech

Comments

# 15 Links Today (2007-08-27) said on 27 August, 2007 11:16 AM

Pingback from  15 Links Today (2007-08-27)

# Tim said on 21 September, 2007 01:45 AM

Hi,

Thanks for the great blog. I was wondering if you know how to reference bdc entity actions other than the default action in the search results xsl?

I can get at the default action {$url}, but how would I get at the other actions? I'm actually trying to bypass the need to go to the profile page.

Thanks.

Tim.

# notorioustech said on 21 September, 2007 02:13 AM

Yes I do know how. If you are using SharePoint Search out of the box, then you can edit the search results webpart's xslt to add some custom logic for your specific BDC entry. You will first need to add a metadata property to the results properties that you can use to identify that particular result as being your BDC entity. Then just replace their xslt :

<span class="srch-Title">

  <a href="{$url}" id="{concat('CSR_',$id)}" title="{$url}">

   <xsl:choose>

    <xsl:when test="hithighlightedproperties/HHTitle[. != '']">

        <xsl:call-template name="HitHighlighting">

         <xsl:with-param name="hh" select="hithighlightedproperties/HHTitle" />

        </xsl:call-template>  

    </xsl:when>

    <xsl:otherwise><xsl:value-of select="title"/></xsl:otherwise>

   </xsl:choose>

  </a>

   <br/>

  </span>

with something like

<span class="srch-Title">

  <a id="{concat('CSR_',$id)}" title="{$url}">

  <xsl:attribute name="href">

  <xsl:choose>

    <xsl:when test="@MYBDCPROPERTY = 'SOMETHING'">

       <xsl:text disable-output-escaping="yes">yourserver/dosomeaction.aspx select="@MYBDCITEMID"/>

    </xsl:when>

    <xsl:otherwise>

    <xsl:value-of select="$url"/>

    </xsl:otherwise>

   </xsl:choose>

  </xsl:attribute>

   <xsl:choose>

    <xsl:when test="hithighlightedproperties/HHTitle[. != '']">

        <xsl:call-template name="HitHighlighting">

         <xsl:with-param name="hh" select="hithighlightedproperties/HHTitle" />

        </xsl:call-template>  

    </xsl:when>

    <xsl:otherwise><xsl:value-of select="title"/></xsl:otherwise>

   </xsl:choose>

  </a>

   <br/>

  </span>

You will need to do this at the other location that outputs the url too.

OR you could use Ontolica and create cool drop down menus with all the actions you want without any xslt editing needed. (I don't work for them BTW, just like their product)

# notorioustech said on 21 September, 2007 02:42 AM

Look close at the xslt in the previous post some of it gets chopped by community server, but you get the idea.

# Tim said on 21 September, 2007 05:43 AM

Thanks for that.

I see what you've done here ... more/or less hardcoding the aspx page and passing in an id to uniquely identify the selected item.

My scope is set to only return 1 bdc entity, so I dont need to test for that.

But, what I want is to get the full "Navigate to this URL" from a BDC Entity Action, other than the default action (View Profile).

Does that make sense?

Thanks

Tim

# notorioustech said on 21 September, 2007 10:45 AM

Yes, makes sense. Just don't see any straight forward way of getting that, unless actions can be combined into a managed property the search service won't return them.  There are some other more painful approaches to this that you could try, which I am sure you already know about:

1. Add actual .net code to the rendering xslt to make callouts to the SharePoint object model to lookup up the actions.

2. write your own search interface to replace the Microsoft ones. I have done this and it's not that bad with all the samples out there. It is a shame that we can't just replace the one search results web part but MS made their search interface non extensible.

- Sorry I don't have a more elegant solution.

# Tim said on 21 September, 2007 05:12 PM

Yep. I guessed that much after your first reply. Pity that. You gave me a good idea though... I'll pass in the other action urls as mapped metadata and build a menu of sorts in in the xsl.

I like the ontolica product as well, its just that my company doesnt want to spend any more on this sharepoint installation at this point.

Also, I like the look of your other points from the original post. I want to investigate an integration with both citrix and launchinIE.

Thanks again for the help.

# notorioustech said on 21 September, 2007 06:00 PM

No problem.

All I ask is that at some point you create an account on sharepointsearch.com and contribute some of what you have learned in this implementation either through a blog or possibly an article to help others with similar issues.

Note that passing in the action urls as metadata will make them searchable.

-Cheers

# Tim said on 24 September, 2007 11:02 PM

Sure thing.

I checked out the sharepointsearch.com site. It looks good.

Another question - with the BDC search results XSL ...

Do you now how I might change the sort order?

I was able to change the people search sort order, by placing a xsl:sort tag within the xsl:for-each loop. However, the BDC search results XSL doesn't seem to have an xsl:for each loop.

Mind you this only sorted the results per page. The results were still sorted by relevance across pages.

Tim.

# notorioustech said on 25 September, 2007 12:40 AM

There is a for loop in the people xslt? I haven't seen it before.

Anyways. You can add a for loop to the bdc results xslt easily enough.

Make the <xsl:template match="Result">

be a named template and add a for loop in place of the <xsl:apply-templates /> in the body template.

# Tim said on 25 September, 2007 01:01 AM

Your right. There is no for loop in the out-of-the-box people xsl. I remember now - that I used SPD to convert the web part to an XSLT dataview. The resulting xsl had the for-each loop!

Now ... I'll try out your suggestion.

# Padmaja said on 16 October, 2007 06:07 AM

Hi Tim, Christopher,

    I am having Search configured using BDC. BDC results are using xslt for formatting. I want to sort the results of each page based on some managed properties (more than one). Right now the results are displayed in the Order by Rank descending, using full text query.

Is there a way to sort the results based on managed properties in each page using xslt. Can you provide some sample on how to achieve that.

Thanks in Advance for any valuable input.

# Courtenay farquharson said on 27 March, 2008 05:18 AM

Hi Christopher,

Great post on the search results. Ive experiemented with custom dataviews and the BDC etc and its all been very handy!

One thing you mentioned is having a property that says whether an item is readonly or not and provide a link to edit/check out. On the Search webpart the documents are opened in read-only form, whereas obviously when you go to the actual document library it can be opened in readonly or edit form.

How do i add this functionality to open the document in edit mode from the search web part?

your help is greatly appreciated!

# make money online said on 04 April, 2008 04:09 AM

News, analysis, feature stories, random thoughts... if it's about college basketball, either in season or during the summer doldrums, you'll find it in Beyond the Arc.

# Prashant said on 24 June, 2008 12:07 PM

Hi notorious tech,

Great post.

Can you guide me on how to launch a custom exe, i can use launchinie whirly web tool, but how to pass the document to my exe.

Say i have a text file checked in to sharepoint and i want to open notepadpro on right click and launch the notepadpro which will open the document for which i had clicked.

Thanks

Leave a Comment

(required) 
(required) 
(optional)
(required)