Getting SearchBoxEx to work on a Branded MySite Host

If you’ve seen the out-of-box MySite Host, you’ll notice that it doesn’t have a normal search box included as part of the master page, and instead just has a Find People search box:

The Find People search box on a MySite Host

When you perform a search with this box, you are taken to the people scope results page (PeopleResults.aspx) in the Search Center that is defined in your User Profile Service Application’s My Site Settings > Setup My Sites page.

If you go to your My Site Host’s Site Settings > Site Collection Administration > Search Settings page, you’ll see that by default it’s configured to not use custom scopes, to not show the scopes dropdown, and to use the OSSSearchResults.aspx page for contextual scopes. The settings on this page are completely ignored by the Find People search box on the MySite Host master page (because it looks to the Search Center configuration in the User Profile Service Application).

MySite Host default search settings

If you dig into the mysite.master, you will not find a SearchBox or SearchBoxEx control, and will find that the PlaceholderSearchArea is set to Visible=”false”:

Digging in to the mysite.master, there is a DelegateControl called GlobalNavigation, and if you look at a Feature called MySiteNavigation, you’ll find that it references an ASCX control for this delegate control:

Inside mysitetopnavigation.ascx, you’ll find the reference to the Find People search control, which is a PeopleSearchBoxEx control:

If you want to customize the MySite Host branding and include a normal search box with scope dropdown, you’ll want to use your own master page and include the SearchBoxEx directly. Normally this control is included in the PlaceholderSearchArea, but you can include it manually in your masterpage.

Your first inclination might be to include this control, set UseSiteDropDownMode=”true”, UseSiteDefaults=”true” and then enter your search center url and dropdown settings in the Site Collection Administration > Search Settings page, like so:

This is what you would typically use on any other site, like a Publishing portal, so that an admin of the site could have some level of control over the search box and scopes. However if you try this, you will notice that the dropdown for scopes will never appear.

The MySite Host is a special beast and is configured to know about the User Profile Service Application settings, so the right way to go about this is to 1) use the default MySite Host Search settings (no scopes, no dropdown, see screenshot above). Then configure your SearchBoxEx like this:

You can play with the DropDownMode, but personally I like to use ShowDD_NoContextual because the MySite host is not configured to be indexed by the search server, so a contextual scope doesn’t make much sense to offer anyway.