Dot Net Mafia

Group site for developer blogs dealing with (usually) .NET, SharePoint 2013, SharePoint 2010, Office 365, SharePoint Online, and other Microsoft products, as well as some discussion of general programming related concepts.

This Blog



Corey Roth [MVP]

A SharePoint MVP bringing you the latest time saving tips for SharePoint 2013, Office 365 / SharePoint Online and Visual Studio 2013.

How to: search the contents of a document set

I saw this question in the forums the other day, so I decided to see if it is possible to use SharePoint search to query just the contents of a document set.  It turns out that you can and it is quite easy.  Consider the following document set.  It has a number of contracts in it.


I want to be able to search the content of the document set.  Document Sets are really just fancy folders.  You can tell this by examining the URL when you are viewing one.  Since it is just a folder, I realized that we can make use of the Site keyword that I have talked about before.  Simply provide the URL and you will return all of the results of the document set.  Here is an example.  I can return the entire contents of the document set like in this example.

site:"http://sp2010/RM Test/Work Package 1/"

In the above example, my server is sp2010, the document library is RM Test and the document set is named Work Package 1.  Here are the search results.  Note, that it returns the documents in the document set as well as the welcome page.


Of course we can combine this with other terms.  For example if I want to search for documents in this set that involve the state of Texas, I would issue the following query.

site:"http://sp2010/RM Test/Work Package 1/" Texas


As you can see querying the document set is easy.  Now your users might not be able to create a query like that very easily, but as a developer it gives you something to work with.  To search within large document sets, you could add a custom SearchBoxEx web part to the welcome page.  The reason you would have to customize it is because you need the site keyword to pass in the URL of the document set.  This could be done by inheriting from SearchBoxEx and by adding some simple code to get the current URL.  I’ll look at building this web part in the future when I have more time.  In the meantime, if you build one, drop me a line and tell me about it.



Sladescross's Blog said:

Pingback from  Sladescross's Blog

November 10, 2011 4:21 AM

Sladescross's Blog said:

Pingback from  Sladescross's Blog

November 10, 2011 4:21 AM

Sharepoint Updates November-10-2011 | SDavara's Sharepoint Knowledge Center said:

Pingback from  Sharepoint Updates November-10-2011 | SDavara's Sharepoint Knowledge Center

November 11, 2011 2:25 AM

SharePoint Daily » Blog Archive » All Microsoft Products Lead to the Cloud; Silverlight Exit Strategy; Spellcheck in IE10 said:

Pingback from  SharePoint Daily  » Blog Archive   » All Microsoft Products Lead to the Cloud; Silverlight Exit Strategy; Spellcheck in IE10

November 11, 2011 7:46 AM

SharePoint Daily said:

Don't forget, SharePoint Saturday Denver starts today. Stop by the Bamboo booth for details on our

November 11, 2011 7:48 AM

Uday said:

Thanks for this blog,

Nice blog.

November 30, 2011 11:18 PM

Rajesh said:

I have a almost opposite requirement to show only the document set when the search keyword is contained either in the document set or in any of the documents within that document set. Currently what happens is when a text is contained within in any of the document(s), all those documents are returned. Instead I would want the search to show only the document set, so there will be one result per document set. Is this possible?

February 3, 2012 11:37 AM

CoreyRoth said:

@Rajesh Try using the ContentType keyword passing the Document Set content type.  I haven't tried it but it might work.

February 6, 2012 11:45 PM

Ben said:


I have the same requirement as Rajesh, but I'm using SP2013.

Corey or Rajesh, did you find a solution for this problem?


May 13, 2014 3:34 AM

Inder said:

Dear Corey,

We have one file share and and users want to Display Parent folder in search results as refinement like we have for Word/Excel/PPT/Author etc. Please let me know how to achieve it in Fast Search for SP 2010. Thanks.



June 10, 2014 9:48 PM

Leave a Comment


About CoreyRoth

Corey Roth is an independent SharePoint consultant specializing in ECM, Apps, and Search.
2015 dotnetmafia.
Powered by Community Server (Non-Commercial Edition), by Telligent Systems