Connect.Collaborate.SharePoint

Customising SharePoint Search (MOSS only)

Thought would kill 2 birds with one stone here. First is an example of adding Microsoft Live Search results to the SharePoint Search page. Second is adding custom list/document property value to the search results summary. Both can be seen in the screen shot below…

Why would you want Microsoft Live search results on your Intranet search page?
You will probably find that users search both the Intranet and Intranet for the same search term. This could save time.

The Live search results are obtained through a Web Service You just have to:

  1. register for anAppID from here…
  2. download he .webpart file from here…
  3. edit the AppID value (search for "ReplaceMe" in the .webpart file) and insert your string from step 1
  4. import the dwp file onto your search page (or another tab if you are using the search center).

     

Because it uses the Data View, there is nothing that needs to be installed on your SharePoint server for this to work.

 

Why would you want to display metadata in the search summary results?

Although search engines claim to produce the best "relevant" results, I like to use my own intelligence. If the metadata was worth collecting in the first place then it may help me in selecting which result is relevant to me.

 

To use the custom metadata in the results page there are several steps involved:

  1. Create a new in your Shared Services Admin > Search Settings > Managed Properties page.
    In my case I added a property name "Platform" and added the crawled property "ows_Platform(Text)"
  2. Edit the search web page on your MOSS site
  3. Edit the properties for the Search Core Results web part
  4. In the "Results Query Options" section, in the "Selected columns" field add an XML fragment for your Managed Property name
    in my case <Column Name="Platform"/>
  5. In the "Data View Properties" section, use the XSL Editor and look for the <!-- A generic template to display string with non 0 string length (used for author and lastmodified time --> and insert the following template before it

    <!-- A generic template to display SharePoint Metadata -->
    <xsl:template name="DisplayMetadata">
    <xsl:param name="str" />
    <xsl:param name="name" />
    <xsl:if test='string-length($str) &gt; 0'>
    (Platform -
    <xsl:value-of select="$str" />)
    </xsl:if>
    </xsl:template>

    The find <xsl:with-param name="str" select="author" /> and place the following after the </xsl:call-template> of the previous line

    <xsl:call-template name="DisplayMetadata">
    <xsl:with-param name="str" select="platform" />
    </xsl:call-template>

That's it…

A few tips:

  1. SharePoint list/library custom columns won't appear in the search property mapping UI until after a crawl. The re always prefixed with ows_
  2. Values for the custom properties will not appear in the search results page until after the property has be defined and a full crawl is done
Posted by Ian Morrish on Friday, 22 Dec 2006 01:47 | 1 Comments

Links to this post

Trackback from Blog on 12 Apr 2008 08:58

Name

Url

Email

Comments

CAPTCHA Image Validation