1

We are using SP 2013 on-prem. We have an Intranet and a MySite.

When searching from MySite, I want the search to redirect to the search center at Intranet so the search results can be displayed at a common place for both web applications.

I have seen there are a lot of properties that can be set in a property bag, but I am confused at which to use.

I am using an event receiver.

Please advice which property to use: i.e. SRCH_SB_SET_WEB, SRCH_SB_SET_WEB etc.

1 Answer 1

2

If you go to Site Settings > Search Settings > Send queries to a custom results page URL, you can send your results to the Search Center using the Search Center URL property, thus:

{SearchCenterURL}/results.aspx

EDIT I believe the properties are as follows:

Site Collection Search Center = SRCH_ENH_FTR_URL

Site Collection Search Dropdown Mode = SRCH_SITE_DROPDOWN_MODE

Site Collection Search Results Page = SRCH_TRAGET_RESULTS_PAGE

Set thusly:

using (SPSite site = new SPSite("http://abhay-pc:1212/lt"))
{
   using (SPWeb web = site.OpenWeb())
   {
     web.AllProperties["SRCH_ENH_FTR_URL"] = "/SitePages/Customsearch.aspx";
     web.AllProperties["SRCH_SITE_DROPDOWN_MODE"] = "HideScopeDD_DefaultContextual" ;
     web.AllProperties["SRCH_TRAGET_RESULTS_PAGE"] = "/SitePages/Customsearch.aspx";
     web..Update();
  }
}
1
  • 1
    I know about this. What I am wondering about is how to do this programmatically as all my sites are created as new site collections and the url needs to be set for every site collection. I need to fix this in my event receiver which triggers each time a new my site is provisioned.
    – Ilyas
    Commented Apr 21, 2016 at 8:49

Your Answer

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

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