Question

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.

Was it helpful?

Solution

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();
  }
}
Licensed under: CC-BY-SA with attribution
Not affiliated with sharepoint.stackexchange
scroll top