?
Solved

SharePoint 2010 - Search or Filter Document Sets

Posted on 2014-04-24
8
Medium Priority
?
1,514 Views
Last Modified: 2014-04-30
I have a document library configured to use Document Sets. Additionally I created a metadata term set and the managed metadata column for the purpose of adding that column to the documents that are within the document set. I have enabled Metadata Navigation and Filtering and enabled that for the document library. Everything works fine, including the filtering.

When I use the filter, I am presented with the document sets that meet the criteria, and when I go in to a document set, I see the documents. What I need to do is go a step further and enable the capability to filter or search within the document set.

Any suggestions or help in getting this to work would be greatly appreciated.
0
Comment
Question by:Walter Curtis
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 4
8 Comments
 
LVL 32

Accepted Solution

by:
Jamie McAllister MVP earned 2000 total points
ID: 40022007
To define a specific path you want search result for you need to provide a 'u' querystring parameter to the search results webpart which specifies that path.

I put together some javascript to look at the url within my Document Set. When you're in the Document Set there's an argument in the url called 'RootFolder'. This includes the Document Set name and an ugly representation of the path.

I extract this on a button click (normal HTML button with some javascript) and forward the page on to Search results page, specifying the Document Set path as my 'u' querystring parameter.

To get this functionality into your Document Set Homepage, go into Doc Set Settings and edit homepage. Insert a Content Editor Web Part into the page and add your script/html for the custom search in there.

My main function that does the work is here;

function customSearch(inputId) {

	var origUrl = window.location.href;
	var searchUrl = '';
	
	try
	{
	if (origUrl.indexOf("&k=") != -1)
	{
		searchUrl = origUrl.split('&k=')[0];
	}
	else
	{
		searchUrl = origUrl;
	}
	}
	catch (err)
	{
		searchUrl = origUrl;
	}
	
	var searchTerm = "&k=" + document.getElementById(inputId).value;
var baseURL = "http://MyDomain";

var rootFolder = getParam("RootFolder");

var decoded = urldecode(rootFolder);

var uri = baseURL + decoded;

var encoded = encodeURIComponent(uri)

	var listParams = "&u=" + encoded;
	window.location.href = searchUrl + searchTerm + listParams;
}

Open in new window


I also took this a step further and added a Search Results Web part to actually display the search results within the Doc Set Homepage, but that was somewhat more complicated...
0
 
LVL 19

Author Comment

by:Walter Curtis
ID: 40023544
Thanks, this is very helpful and I understand the approach. This part I am somewhat unsure of:

forward the page on to Search results page, specifying the Document Set path as my 'u' querystring parameter.

Would it be possible for you to include the entire code including the html part?

Many Thanks
0
 
LVL 32

Expert Comment

by:Jamie McAllister MVP
ID: 40024429
This line will do the redirect;

window.location.href = searchUrl + searchTerm + listParams;

Open in new window


In my case I actually redirected to the same page I was on (The Doc Set Home). I added a Search Results Webpart above the Doc Set Contents web Part, which is invisible unless Search has been called.

Then I got my hands on some XSL that changed the search results to look like my Doc Set default View.

That XSL is here;

http://sharepoint2010search.codeplex.com/
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 19

Author Comment

by:Walter Curtis
ID: 40028092
I have all code added, two extras functions and the results web part on the document set welcome page. All is working fine, but I am getting no results :-(

Any idea what I might be missing. Note: when I am at the document library level and use the metadata filter I am able to filter out all except for what I query. Just at the document set level I get no results at all.

Many thanks
0
 
LVL 32

Expert Comment

by:Jamie McAllister MVP
ID: 40028187
What does the url of the page look like when there's no results?  Can you post it here?
0
 
LVL 32

Expert Comment

by:Jamie McAllister MVP
ID: 40028939
Immediate difference I can see is that your 'u' parameter is not url encoded and mine is.

replace the 'https://' in your 'u' param to 'https%3A%2F%2F' (and the rest of that param).
0
 
LVL 19

Author Comment

by:Walter Curtis
ID: 40031973
Thanks for the info. Giving it a go and will post when it is up and running.
0

Featured Post

NFR key for Veeam Backup for Microsoft Office 365

Veeam is happy to provide a free NFR license (for 1 year, up to 10 users). This license allows for the non‑production use of Veeam Backup for Microsoft Office 365 in your home lab without any feature limitations.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

We had a requirement to extract data from a SharePoint 2010 Customer List into a CSV file and then place the CSV file into a directory on the network so that the file could be consumed by an AS400 system. I will share in Part 1 how to Extract the Da…
A recent project that involved parsing Tableau Desktop and Server log files to extract reusable user queries for use in other systems. I chose to use PowerShell to gather the data, and SharePoint to present it...
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
Suggested Courses

801 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question