I wrote a post over at the Intergen blog on SharePoint 2013 Search:
Search is an area of SharePoint that has been greatly improved with the forthcoming SharePoint 2013 release from Microsoft. The changes range from a new richer user interface through to a completely revamped back-end architecture…
Filed under: 2013, Search, SharePoint, Tech Ed | Tags: Search, SharePoint 2013;
I was luckily enough to attend and present at Tech Ed New Zealand again this year. My session was OSP206: What’s New in SharePoint 2013 Search?
It was a 200-250 level session to look at the changes from a few different perspectives:
- The new UI
- The new architecture
- Administration changes
- Developer changes
- A demonstration of customising search results using Display Templates and Query Rules
I had a lot of fun attending and speaking at Tech Ed and really can’t wait for SharePoint 2013 to be released! Until then here are the slides from the session.
Contextual scopes are a really useful way of performing searches that are restricted to a specific site or list. The “This Site: [Site Name]”, “This List: [List Name]” are the dead giveaways for a contextual scope (I even think you can get a folder context too “This Folder” but it alludes me most of the time). What’s better is contextual scopes are auto-magically created and managed by SharePoint for you so you should pretty much just use them in my opinion.
You may come across a problem where SharePoint search works fine except for your contextual scopes. Your global search scopes all return results but for some strange reason the contextual scopes are empty…
I came across this problem a couple of times recently and the fix is really pretty simple – check your alternate access mapping (AAM) settings and make sure the host header that is specified in your default zone is the same url you have used in your search content source. Normally SharePoint kindly creates the entry in the content source whenever you create a web application but if you have changed around any AAM settings and these two things don’t match then your contextual results will be empty. Case Closed!
Search is a fundamental component of any SharePoint solution and 2010 has some subtle differences and great improvements over its 2007 predecessor:
- One improvement are refiners, a new part of the search user interface (formerly known as facets), which allow you refine the search results based on metadata and even better they are extensible
- One important difference between 2007 and 2010 is the use of a specific master page in the Search Centres – the minimal.master master page
I’m not a big fan of minimal.master used within the Enterprise Search Centre so that’s the focus of the rest of this post. I’ll propose a way to deliver a fix which basically boils down to not using the minimal.master.
So what’s the problem with minimal.master? Minimal.master is a cut down master page that is new to SharePoint 2010 and used by both Enterprise Search and Office Web Apps. As the Search master page it lacks a few key components available in the other SharePoint 2010 master pages. One fundamental component that is missing in minimal.master are navigation controls.
The minimal.master lacks most of the usual navigation controls you expect and need.
V4.master has the standard top navigation and the new 2010 breadcrumb (hidden inside the folder “up” icon)
Missing the main navigation leaves an Enterprise Search Centre completely isolated from the rest of your SharePoint solution. This is a big limitation – is there are any situation where you shouldn’t be able to get from your search results back to the main and/or other sites?
So why don’t we just change the search master page to one of those other fully featured ones like V4.master? Yeah that was my first idea too. And look what we get…
An Enterprise Search Centre with v4.master applied “floats” the search controls into the breadcrumb navigation.
That wasn’t the result I was expecting and I guess it wasn’t the result most people were expecting if they tried this? This is not a bug but one of those “by design” problems. What you’re seeing is the way the four page layouts of Enterprise Search have been implemented to work specifically with the placeholders in the minimal.master master page. Personally I think this was a poor implementation decision because it uses some of the core placeholders completely differently than the other OOTB SharePoint master pages. Compare V4.master and minimal.master:
|Place Holder||Use in Minimal.master for search||Use in V4.master for…most other things|
|TitleInBreadCrumb||Search controls||Breadcrumb navigation controls|
|SPNavigation||Empty in the master page. The search page layouts add page editing controls and the ribbon instead.||Page editing controls and the ribbon|
The Current Approaches to using a Custom Master Page with Search
We have two options if we want to get rid of the minimal.master from search and put back some of the things we have lost:
- Create a custom search master page that is compatible with the search page layouts; or
- Modify the search page layouts to make them compatible with an existing custom master page
If you want to do the first option and create a custom master page for search then Randy Drisgill has a really useful and detailed post on how to convert a V4.master (normal) master page to work with the Search Centre.
The second alternative solution is to modify the page layouts to work with your existing custom master page. I first came across the idea via Chris O’Connor and prefer this approach. It’s biggest benefit is you only have to develop/test/maintain one master page which can be used on all your SharePoint sites including the search site!
Unfortunately there is at least one negative side effect to modifying the search page layouts – it makes them unghosted (customized). Unghosted files are generally frowned upon in SharePointland so this approach won’t always suit everyone’s environment/requirements. The biggest problem, and a very valid reason to dislike unghosted files, is once they are customized a copy lives in the content database that is disconnected from the original file system version. This means:
- These page layouts will not be updated by any changes to the file system versions such as solution (wsp) upgrades and service packs
- There is a performance penalty (I don’t know how much?) because of the extra database hit required to retrieve the page layout from the content database
Fix Option 2. Explained
There are a few changes that have to be made to all of the search page layouts and your custom master page to implement fix option number 2. To make this as clean as possible I have packaged the changes into a sandbox solution and use a site collection feature (feature activation receiver) to perform all of the heavy lifting in the page layouts:
- Change the target placeholder that is used by the search controls by replacing the Id from TitleInBreadCrumb to a custom placeholder ID CustomSearchControls
- Remove the SPNavigation placeholder and all its content from the page layouts. This content placeholder is in the v4 master page already so it’s just a duplicate and causes weird ribbon “jumping”
- Add some CSS style rules to hide the left navigation areas of the page because search doesn’t use this area of the page
A big benefit of doing all that work in a feature receiver is the changes are all reverted and the page layouts are reghosted/uncustomized if the feature is deactivated.
Last point – there are changes that must be made to your custom master page to support these modified page layouts. If you don’t add the following placeholder you’ll get an error. The screen shot below shows what needs to be added (the wrapping <div> isn’t strictly necessary but it allows for any custom styling that might also be needed).
And once you upload the sandbox solution to the solution gallery, activate the solution/feature and switch your master page to one with the custom placeholder this is what you will see:
This is a good place to stop. The files are up on codeplex and I hope to do a follow up post soon that explains the source code in detail. If you have any ideas on how to improve this or just general comments please hit me up via a blog comment or on twitter. For now here are links to the files:
- Sandbox solution with a site collection feature to do the page layout fix-up described in the post – Search.CustomMasterPageAdapter.wsp
- Source code of the feature receiver – PageLayoutFixup.cs
- Example custom master page which is just v4.master with the custom place holder added – Custom.v4.master
I have so many posts in draft status and nothing ever getting published, therefore this is the super-quick-two-things-to-check-up-on-later post. As usual, at least of of late, the most interesting content I am finding is coming from twitter tweets. This just goes to show Joel Oleson’s post on the SharePoint community which talked about technologies like twitter is a fairly accurate reflection on the current state of things.
Via @harbars: Labs/samples for #SharePoint web content management on http://www.mssharepointdeveloper.com #WCM.
Via @SharePointMVPs: Matthew McDermott’s search session at Tech Ed OFC317 Search Challenges and Tricks
I must really get around to putting up those other posts!
A couple more interesting things from today:
Reza Alirezaei (@rezaal): Working with Structured Data in Microsoft Office SharePoint Server 2007 (Part 4): SharePoint Designer. Includes a nice demo on how to create a master/detail views on data with the incredibly useful Data Form Web Part.
Lars Fastrup: Microsoft SharePoint 2010 news from TechEd US 2009. Includes some interesting observations about new functionality/features in SharePoint 2010, like the office ribbon, gleaned by seeing it in action during some presentations.