Skip to content

Search field on the SharePoint search results page

November 17, 2010

SharePoint 2007

The default search results page for a SharePoint site (_layouts/searchresults.aspx) is located under the _layouts folder, so evidently it uses not the masterpage of the site but the server-level application.master page which is located on the filesystem on the same _layouts folder.

Customizing this page will affect not only all the web applications on the server but also all the application pages under the _layouts folder. Besides the Site Settings pages this includes for example the Recycle Bin, View All Site Content, Manage Permissions pages so modifying this page can have a significant impact on the site.

Anyway, it can be done but there are some important things to note.

The application master doesn’t contain the search box in the header(SmallSearchInputBox delegate control) but it is useful in a search results page to have a search field too, it was necessary to put this search filed into the SearchResults.aspx page itself. Some wise guys at MS found out that the breadcrumb placeholder (PlaceHolderTitleBreadcrumb) is an ideal place to put this control. This is how it looks like:

So when customizing the application master, keep in mind that the PlaceHolderTitleBreadcrumb may contain not only the breadcrumb, but also some unexpected controls. If you hide the breadcrumb in the application.master, the search field will also disappear from the search results page.

SharePoint 2010 

The solution to put the search field in the breadcrumb was apparently highly welcomed by the SharePoint development community so MS decided to do the same in the 2010 version. Here the minimal.master page (which is the default masterpage for the Search Center) contains the search field in the breadcrumb placeholder. So if you happen to change the masterpage of the Search Center lets say to the default.master of your portal (which is only a couple of clicks on the 2010 UI and its a really great feature that you can do it), then the search field simply disappears from the Search Center pages.

Why? Because in the SharePoint 2010 v4.master (and other masterpages) the breadcrumb is implemented as a dynamic control. Becomes visible only when you click the “Folder” icon in the header. And yes, when you open the breadcrumb, you can find the hidden search filed in its dropdown list 🙂

So what to do? Either try to follow the path of customization that is implied by this solution: use the minimal.master as the masterpage for the Search Center while the v4.master or any customized masterpage based on the v4.mater for the content pages.

If you still want to use your custom masterpage for the Search Center also (which is a quite understandable requirement) then you can try moving the PlaceHolderTitleBreadcrumb placeholder right above the PlaceHolderMain placeholder. (Move only the placeholder, leave its original content – the breadcrumb  in its original position). Good luck!

Advertisements
Leave a Comment

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: