Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

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.

share|improve this question

4 Answers 4

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()
share|improve this answer
    
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. –  SystemAccount May 24 '12 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. –  Per Jakobsen May 24 '12 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. –  SystemAccount May 24 '12 at 19:48

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).

share|improve this answer
    
I absolutely agree that my topology could have been set up differently. Unfortunately I was not able to be a part of that decision. –  SystemAccount May 24 '12 at 20:55

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>
share|improve this answer
    
Could you explain why this method is preferred over SearchBoxEx? –  SystemAccount May 25 '12 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.) –  Paul Schaeflein May 30 '12 at 15:16
up vote 0 down vote accepted

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.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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