For one of our clients we were looking for a solution to remove or replace the search result page that is used by the contextual searches from the Search DropDownBox. This because the contextual search let to a page “/_layouts/osssearchresults.aspx” or “/_layouts/searchresults.aspx” depending on whether you use WSS or MOSS.
Because this page has another layout then the search center they thought people would get confused. So they wanted to remove the contextual search or let them go to the custom search center.
When I was searching over the internet for a solution I found this post from Mark Arend. What he does in his post is change the out of the box page and let it redirect to his custom Search Center. This looks like a great solution but I won’t recommend you to edit out of the box pages from SharePoint so we went looking for another solution.
We thought that there would be a certain property for disabling the searches. But there isn’t, you have to create a custom feature were in you define a new search area where in you want to disable the contextual search.
You can define it like this:
<?xml version="1.0" encoding="utf-8" ?> <Feature Id="89FC9564-0E82-490f-AD47-8678A619AB75A" Title="CustomSearchBox" Description="$Resources:EnhancedSearch_Feature_Description;" DefaultResourceFile="spscore" Version="188.8.131.52" Scope="WebApplication" xmlns="http://schemas.microsoft.com/sharepoint/"> <ElementManifests> <ElementManifest Location="searcharea.xml"/> </ElementManifests> </Feature>
This is the code you need for the feature. In de searcharea.xml the xml defines the search area:
<?xml version="1.0" encoding="utf-8" ?> <Elements xmlns="http://schemas.microsoft.com/sharepoint/"> <Control Id="SmallSearchInputBox" Sequence="5" ControlClass="Microsoft.SharePoint.Portal.WebControls.SearchBoxEx" ControlAssembly="Microsoft.SharePoint.Portal, Version=184.108.40.206, Culture=neutral, PublicKeyToken=71e9bce111e9429c"> <Property Name="GoImageUrl">/_layouts/images/gosearch.gif</Property> <Property Name="GoImageUrlRTL">/_layouts/images/goRTL.gif</Property> <Property Name="GoImageActiveUrl">/_layouts/images/gosearch.gif</Property> <Property Name="GoImageActiveUrlRTL">/_layouts/images/goRTL.gif</Property> <Property Name="UseSiteDefaults">true</Property> <Property Name="DropDownMode">ShowDD_NoContextual</Property> <Property Name="ScopeDisplayGroupName">Facilicom</Property> <Property Name="FrameType">None</Property> <Property Name="ShowAdvancedSearch">false</Property> </Control> </Elements>
In the above example you can see that there are many properties available for the search area. The most properties found this page.
For not showing the Contextual search you have to set the DropDownMode to: ShowDD_NoContextual.
Tanks to Mortens