문제

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!

도움이 되었습니까?

해결책

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.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 sharepoint.stackexchange
scroll top