XSLT creation revisited for SharePoint 2010 Search and a small search tip

Search tip
If you search with only a hash “#”, then you will do an empty search and all results are returned.

When modifying the xslt for the Core Search Result Webpart it’s nice to know what data is actually included in the xml.

SharePoint 2010 has a section called “How to: View Search Results XML Data” which also existed for 2007. This time around it has included the important (obsolete for HTML5) XMP tag which makes rendering xml a breeze. Best practice is to use the PRE tag, but then you have to html encode your tags for it to render correctly.

By substituting your xslt with the snippet below, you will get xml output instead in for your web part.

Which results in something like this

This is a result using FS4SP which includes the docvector tag which included concepts from the text. The last properties starting with “esc” are custom defined fields which I’ve added to the Display Properties –> Fetched Properties setting on the Core Result Web Part.

With this xml as a reference, it’s easy to create and modify the default xslt.  I usually keep two Core Result Web Parts on the page while creating it, one with the rendered output and one with xml for reference. Once I’m done, I’ll remove my debug part from the page and package it all up for deployment.

Article written by

Computer literate and search enthusiast with an interest for sharepoint, coding, and life in general :)

2 response to: «XSLT creation revisited for SharePoint 2010 Search and a small search tip»

  1. November 27, 2010 at 21:48 | Permalink

    Hi Mikael!

    Nice intro to FS4SP result sets. Very useful for a SP beginner like me.

    It’s good to see that keyword highlighting is provided for both title, body and url by default. The FAST ESP collapse fields (fcocount and fcoid) is something I wish they’d leave behind though, in favour for a more semantic domain model. It only works 100% for site collapsing, but not for the Google-style blended/universal search IMHO.

    I wonder how you would go about extending the Core Search Result Webpart to support blended search. Any thoughts on that?

  2. June 26, 2012 at 05:59 | Permalink

    Awesome, is there a way to set output as JSON, Mikael?



Leave a response





XHTML: These tags are allowed: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">

301 Moved Permanently

Moved Permanently

The document has moved here.


OSLO

Comperio AS
Øvre Slottsgate 27
NO-0157 Oslo,
Norway
+47 22 33 71 00
View map

STOCKHOLM

Search Provider Sverige AB
Gamla Brogatan 34
SE-11 120 Stockholm
Sweden
+46 8-21 49 00
View map