SharePoint Events

  5/13/2013 - Conference: SharePoint Summit 2013
  5/21/2013 - Webcast: SharePoint 2013 and ECM: Content Migration and Storage
  5/22/2013 - Webcast: Managing CAD in SharePoint
  5/23/2013 - Webcast: SharePoint Document Automation and E-Forms for Financial Services
  5/24/2013 - Webcast: What's New in Search for SharePoint 2013

 SharePoint Videos

  Why SharePoint 2013
  SharePoint 2013 Launch
  SharePoint 2013 Migration and Governance
  SharePoint 2013 and Enterprise Content Management
  Top Benefits of SharePoint 2013
  What's New in Business Intelligence in Office and SharePoint 2013
  SharePoint and Office 2013 Integration
  SharePoint 2013 Infrastructure Preview
  SharePoint, Lync, and, Exchange in the Cloud with Office 365
  Advanced Reporting in SharePoint with Microsoft Power View

 Archives

Opening SharePoint Links in a new windowUse SHIFT+ENTER to open the menu (new window).
Mail Enabled Lists vs. The Missing Windows 2008 POP3/IMAP Server Use SHIFT+ENTER to open the menu (new window).
7 Tools for SharePoint DevelopersUse SHIFT+ENTER to open the menu (new window).
Public Facing Masterpage TechniquesUse SHIFT+ENTER to open the menu (new window).
How to Quickly Deploy and Activate a Timer Service to Your Site CollectionUse SHIFT+ENTER to open the menu (new window).
Custom SharePoint Master Page Feature with WSP BuilderUse SHIFT+ENTER to open the menu (new window).
Date Math with InfoPathUse SHIFT+ENTER to open the menu (new window).
Enterprise Search Tricks and Tips Part 1Use SHIFT+ENTER to open the menu (new window).
Populating Word Documents With SharePoint Data. Try The DIP!Use SHIFT+ENTER to open the menu (new window).
Programmatic Deep Dive into Blank SharePoint Lookup ColumnsUse SHIFT+ENTER to open the menu (new window).
1 - 10 Next
Enterprise Search Tricks and Tips Part 1

By: Neil Barkhina

One of SharePoint’s best features in my opinion, and one that is often underutilized, is Enterprise Search. Everyone knows you can do searches in SharePoint, but in order to unlock it’sreal potential, certain concepts must be understood. These include things like scopes and managed properties. Over the years I have also learned some tricks which have helped better use these features.

Use the correct version

Just to be clear, there are two types of searches that can be performed in SharePoint. One is the “free” version which is called Windows SharePoint Services Search, and the other one is Enterprise Search which is what you get with Office SharePoint Server. The surprising thing is, many customers we have come across over the years own MOSS, but still run WSS Search! The easiest way to know the version you’re using is to look at the search results page. If the URL ends in “/_layouts/osssearchresults.aspx”you are running the freebee:

 

 

 

SharePoint Blog Enterprise Search Tricks and Tips

However, if your search results page comes back in a URL with /SearchCenter then you are using Enterprise Search:

SharePoint Blog Enterprise Search Tricks and Tips

XSLT Transformations

Enterprise Search uses a special site called the Search Center. A big advantage is that the search results page uses XSL to format its results. This means that you can fully customize it as far as look and feel, and also add functionality. One example is an addition we made to our own intranet. You know how sometimes you want to view the document library that a document is in, but not necessarily want to click the document itself?

SharePoint Blog Enterprise Search Tricks and Tips

Well normally you’d be straining with you mouse to highlight just the base part of the URL in the browser. What we did was modify the XSL to include a “Navigate to Parent” under each search result.  To edit the XSL, edit the search results page and modify the Search Core Results web part. The XSL Editor Button is one of the web part properties:

SharePoint Blog Enterprise Search Tricks and Tips

Then it’s basically a matter of adding a function called “mcs-get-parent” to display the link. Here is XSL:

<xsl:templatename="mcs-get-parent">

<!-- getting the url to the item, returned from search -->

<xsl:paramname="result-url"/>

 

<xsl:variablename="res1">

<xsl:choose>

<!--for now i have now idea how to deal with urls with ? chars, so we would skip them -->

<xsl:whentest="contains( $result-url, '?' )">

<xsl:value-ofselect="$result-url"/>

</xsl:when>

<!--for urls that are not referring the root of the web applications, we perform the processing -->

<xsl:whentest="contains( substring-after( $result-url,'https://') ,'/')">

<xsl:call-templatename="mcs-strip-filename">

<xsl:with-paramname="x"select="$result-url"/>

</xsl:call-template>

</xsl:when>

<!-- for all other conditions we do nothing -->

<xsl:otherwise>

<xsl:value-ofselect="$result-url"/>

</xsl:otherwise>

</xsl:choose>

</xsl:variable>

<!-- postprocessing-->

<xsl:variablename="res2">

<xsl:choose>

<!-- if search returned is the item like http://test we would leave it untouched -->

<xsl:whentest="$result-url=$res1">

<xsl:value-ofselect="$res1"/>

</xsl:when>

<!-- if search returned us the result like http://test/sites/site, than the parent should be http://test and not http://test/sites -->

<xsl:whentest="substring-after($result-url,'sites/')=$res1">

<xsl:value-ofselect="substring-before($result-url,concat('/sites/',$res1))"/>

</xsl:when>

<!-- in all other situations we just strip the doc name from the end and return the result -->

<xsl:otherwise>

<xsl:value-ofselect="substring-before($result-url,$res1)"/>

</xsl:otherwise>

</xsl:choose>

</xsl:variable>

<spanclass="srch-URL"><xsl:textdisable-output-escaping="yes">&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;</xsl:text><ahref="{$res2}">NAVIGATE TO PARENT</a></span>

</xsl:template>

 

 

<xsl:templatename="mcs-strip-filename">

<xsl:paramname="x"/>

<xsl:choose>

<xsl:whentest="contains($x,'/')">

<xsl:call-templatename="mcs-strip-filename">

<xsl:with-paramname="x"select="substring-after($x,'/')"/>

</xsl:call-template>

</xsl:when>

<xsl:otherwise>

<xsl:value-ofselect="$x"/>

</xsl:otherwise>

</xsl:choose>

</xsl:template>


Since our SharePoint intranet uses SSL the XSL was modified to only display HTTPS:// results, however this can be easily changed if your site uses normal http. To display the Navigate to Parent link simply call the XSL Template by passing in the url field that comes back from the search results:

<xsl:call-templatename="mcs-get-parent">

<xsl:with-paramname="result-url"select="url" />

</xsl:call-template>

 

Search Queries

When performing a search, there is specific syntax you can use to narrow down your results. SharePoint uses a special construct called Managed Properties to allow you to filter search results. The difference between Managed Properties and Crawled Properties is that Managed ones get exposed to the end user for searc­­hing. How a Managed Property gets created is abstracted from the user, the actual interface resides in the Shared Services Provider Web Site. But a managed property can be made up of many crawled properties such as SharePoint Columns and even Office Metadata. Users of Office 2003 and earlier have probably encountered this. Documents contain metadata that sits behind the content such as the Author of a document, date created and other metadata as well. To search on a managed property you simply use the syntax [property]:“value”. Here are some examples that you can type right into the SharePoint search box!

1.       Fileextention:xlsx   - this will do a search for all Excel 2007 documents

2.       ContentType:"Discussion"- this will return results from discussion boards.

3.       Author:“NeilBarkhina”   - return documents that I have authored

The examples above are built-in managed properties that you get out of the box. However you can create your own managed properties as well such as “Client” and “Company” tuned to your specific business needs. In future posts I will go into more details of the Enterprise Search Architecture and platform.

-Neil Barkhina

        

Comments

websites directory

Thanks for the nice  Blog :)
at 3/23/2010 9:28 AM

Jordans 2

The blog article very surprised to me! Your writing is good. In this I learned a lot! Thank you
at 6/20/2010 3:58 AM

Enterprise Search

Thanks for the article. I had fun reading it. It also gave me information about enterprise search. Keep it up.
at 4/3/2013 10:44 AM

Searchblox

Great article. I learned a lot. Thanks for this!
at 4/7/2013 11:40 PM

Add Comment

Items on this list require content approval. Your submission will not appear in public views until approved by someone with proper rights. More information on content approval.

Your Name *


e-mail address *


Website (optional)


Comment *


Attachments

 Subscribe

  GigWerks RSS  Gig Werks Mailing List 

 Contact Us

 Connect

 Resources

  On Demand SharePoint Webcast Recordings
  Upcoming Webinars
  SharePoint Resources
  Business Intelligence Resources
  Gig Werks Website



©2009 Gig Werks. All rights reserved. Privacy Policy