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

I have a SharePoint 2010 Publishing site with two variation labels.

At the site collection level, under Search Settings, search is configured as follows:

  • Site Collection Search Center: Do not use custom scopes
  • Site Collection Search Drop Down Mode: Do not show scopes dropdown, and default to contextual scope
  • Site Collection Search Results Page: /_layouts/OSSSearchResults.aspx

When I perform a search, the search results page is at /{Variation}/_layouts/OSSSearchResults.aspx. All good until now.

I added a copy of OSSSearchResults.aspx to my solution and renamed it to MyOSSSearchResults.aspx and then changed the Site Collection Search Results Page setting to /_layouts/MyOSSSearchResults.aspx.

Now when I perform a search, the results are displayed at /_layouts/MyOSSSearchResults.aspx - at the site collection level, above my variations.

What do I need to do to ensure that my custom version of OSSSearchResults.aspx shows search results at the variation level?

Thank you!

share|improve this question
    
What are you trying to achieve though? If you want to customize search results, using Search Center is the way to go because they would allow you to customize via site pages instead of Application pages under _layouts folder. –  Ashish Patel Jul 3 '11 at 22:18
    
It appears that the searchboxex control and the osssearchresults.aspx are tightly integrated, you wont be able to replace it without such unexpected behaviors. –  Ashish Patel Jul 3 '11 at 22:19
    
I was trying to minimize development effort and thought avoiding the Search Center would be a good idea since I'd need to brand it. I also obviously don't want to modify the out of the box OSSSearchResults.aspx, so I thought I could just throw a copy of it up there and modify it. – George Durzi 8 hours ago –  George Durzi Jul 6 '11 at 5:34
add comment

1 Answer 1

up vote 0 down vote accepted

I realize that this isn't the ideal approach for implementing search on a public SharePoint website, but I wanted to put it out there in case other people come across the same issue.

I created a copy of OSSSearchResults.aspx and made the necessary styling and web part configurations to it. I had to do a few more things to get this to work properly within the variations structure and in an anonymous site:

1. Set the Site Collection Search Results Page to ../layouts/Search.aspx

Note the "..", this ensures that my search results page still comes up within my variation, for example, if I search from http://www.domain.com/EN/subsite, the results are at http://www.domain.com/EN/subsite/_layouts/Search.aspx.

If you don't add the ".." to the configuration, the url would be http://www.domain.com/EN/subsite/Pages/_layouts/Search.aspx, which obviously wouldn't work.

2. Change the code behind class for Search.aspx to inherit from UnsecuredLayoutsPageBase and set its AllowAnonymousAccess property to true.

public partial class Search : UnsecuredLayoutsPageBase
{
    protected override bool AllowAnonymousAccess
    {
        get
        {
            return true;
        }
    }
}

Without this, anonymous users won't be able to access the search results page.

3. Change Search and Offline Availability Settings

Make sure that “Always index all Web Parts on this site” is checked, otherwise anonymous users see no results.

share|improve this answer
add comment

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.