A client recently asked how to make "This Site" the default SharePoint search scope from the simple search box on all pages. "This site" does not appear as an option when you try to manage this via the GUI (Site Actions | Site Settings | Site Collection Administration section / Search Scopes), so you can't set it as the default there.
I found the answer on this thread on SharePoint Blogs / SharePoint University:
http://www.sharepointblogs.com/forums/t/16293.aspx?PageIndex=2
and I wanted to reproduce it here with a few additions. User Monty Myers (monty.myers) posted the following; my additions are in red:
Add or Modify the following line in the OSearchEnhancedFeature.xml file located in 12\Template\Features\ : (The full path is C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\12\TEMPLATE\FEATURES\OSearchEnhancedFeature, then open the SearchArea.xml file in NotePad)
This is the line of code you will add:
<Property Name="DropDownMode">ShowDD_DefaultContextual</Property>
The bold line below shows where the line of code needs to be added:
<?xml version="1.0" encoding="utf-8" ?>
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
<Control
Id="SmallSearchInputBox"
Sequence="15"
ControlClass="Microsoft.SharePoint.Portal.WebControls.SearchBoxEx" ControlAssembly="Microsoft.SharePoint.Portal, Version=12.0.0.0, 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="FrameType">None</Property>
<Property Name="ShowAdvancedSearch">true</Property>
<Property Name="DropDownMode">ShowDD_DefaultContextual</Property>
</Control>
</Elements>
After making the change, save the file and do an IISreset.
Important: when you customize the SearchArea.xml file, it is unghosted, meaning that future patches and upgrades could overwrite your changes. As a best practice, you should create a feature to install this unghosted file to current site collections and deploy the change in this manner.
Comments