1

My sys admin set up our SharePoint so there is basically one big site collection with many subsites run by many different people. Each site under the site collection has its own branding. When I search from my page it redirects to url/mysite/_layouts/OSSSearchResults.aspx? but which displays the search results in the master page of the top site in the site collection. I need this to show the search results in a page that matches my own site master page. Any advice?

UPDATE:

I found a way to change the search results page (see below).

I was able to accomplish this by replacing:

<SharePoint:DelegateControl ID="DelegateControl3" runat="server" 
ControlId="SmallSearchInputBox" Version="4"/>

With the following in the Masterpage:

<SharePointWebControls:SearchBoxEx ID="SmallSearchBox" runat="server" 
ShowAdvancedSearch="false" QueryPromptString="Enter Search Term…" 
DropDownMode="HideDD_NoScope" SearchResultPageURL="mycustomsearchresults.aspx" 
ScopeDisplayGroupName="" FrameType="None" DisplaySubmittedSearch="false" />

And then I added a Search Core Results Web Part to the mycustomsearchresults.aspx page to receive the query. It never returns anything but this is a separate problem that existed before I was tasked to brand.

4 Answers 4

1

You can change the search page by modifying the SRCH_TRAGET_RESULTS_PAGE property on each SPWeb. (And yes it's TRAGET :-( )

$web = Get-SPWeb http://www.address.com
$web.AllProperties["SRCH_TRAGET_RESULTS_PAGE"] = ”URL of YOUR SEARCH RESULT PAGE”
$web.update()
3
  • Could you explain where I would find this property to change it? I am a php developer that got tasked with branding SharePoint so most of what you just said is unfamiliar. May 24, 2012 at 19:45
  • The script above is PowerShell to be run in the SharePoint 2010 Management Shell on one of the SharePoint servers. This property can only be changed through code like this on the server. May 24, 2012 at 19:47
  • That sounds like something I would not be able to access. I am not the sys admin or even a site collection admin. I am a lowly site administrator. May 24, 2012 at 19:48
1

It sounds like your overall topology doesn't match your needs.

Firstly, search settings are managed at the site collection level, and the page reference that states where results are displayed from a search is managed at that level (not at a subsite level). While you can do Per's suggestion to set each individual web property, as you pointed out, you don't have sufficient access as you'd need to physically login to the SharePoint box to access/set those properties.

Secondly, branding is typically managed at the site collection level. The only easy way to brand by subsite would be to assign it all in SharePoint Designer, which is far from a best practice. Following a best practice model, branding should be deployed as a SharePoint Solution (WSP file) generated by Visual Studio and activated on a Site Collection scope.

If you have a requirement of search results being targeted based on specific sites, and you want to deploy branding in any way that's at all manageable, you probably need to rethink your overall topology. There's many advantages to using Site Collections vs. Sites, specifically when we talk about scaleability and maintainability. As an example, a Site Collection cannot span multiple content databases, so with your current topology all of your content is forced to be in a single database (which potentially complicates DR, and other issues).

1
  • I absolutely agree that my topology could have been set up differently. Unfortunately I was not able to be a part of that decision. May 24, 2012 at 20:55
1

Instead of replacing the DelegateControl in the masterpage, I would leave it there and create web-scoped feature(s) that leverage this delegate. An example is below. You could have several different features with varying settings, then activate the desired one on each subsite. All with a single masterpage.

<?xml version="1.0" encoding="utf-8"?>
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
  <Control Id="SmallSearchInputBox" Sequence="10" 
           ControlAssembly="Microsoft.Office.Server.Search, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" 
           ControlClass="Microsoft.SharePoint.Portal.WebControls.SearchBoxEx">
    <Property Name="UseSiteDefaults">false</Property>
    <Property Name="UseSiteDropDownMode">false</Property>
    <Property Name="FrameType">None</Property>
    <Property Name="ShowAdvancedSearch">false</Property>
    <Property Name="DropDownModeEx">HideScopeDD</Property>
    <Property Name="SearchResultPageURL">/Search/results.aspx</Property>
    <Property Name="QueryPromptString">Enter Search term...</Property>
  </Control>
</Elements>
2
  • Could you explain why this method is preferred over SearchBoxEx? May 25, 2012 at 13:15
  • It is preferred over removing the DelegateControl from the masterpage. This solution uses SearchBoxEx, just configures it via a Feature. (Look at the ControlClass attribute.) May 30, 2012 at 15:16
0

I found a way to change the search results page (see below).

I was able to accomplish this by replacing:

<SharePoint:DelegateControl ID="DelegateControl3" runat="server" 
ControlId="SmallSearchInputBox" Version="4"/>

With the following in the Masterpage:

<SharePointWebControls:SearchBoxEx ID="SmallSearchBox" runat="server" 
ShowAdvancedSearch="false" QueryPromptString="Enter Search Term…" 
DropDownMode="HideDD_NoScope" SearchResultPageURL="mycustomsearchresults.aspx" 
ScopeDisplayGroupName="" FrameType="None" DisplaySubmittedSearch="false" />

And then I added a Search Core Results Web Part to the mycustomsearchresults.aspx page to receive the query. It never returns anything but this is a separate problem that existed before I was tasked to brand.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.