
Search Scopes & Contextual Search Scopes
Search Scopes:
You can crawl all items under a certain URL and choose to specify search scopes for your users i.e when they search it will only be in the areas you defined.
For example: You have a site http://server and sub-sites of this site, http://server/subsite1 and http://server/subsite2. You crawled all of http://server including the sub-sites but in the search scopes you can create a special scope for http://server/subsite1 and another scope for the http://server/subsite2.
You can create scopes on the server level (which will be applied on all Web Applications). You can also define scopes in a Site Collection.
To create a new scope - open the Scopes page in the Search Settings page or the Search Scopes page into the Site settings under the root site of a Site Collection. You can set a Scope name, add the Scope to display groups (you can connect a display group to the search box and give your users the option to search only in specified scopes) and then set the target results page.
After you create a scope you need to add a rule or rules to this scope.
Like crawl rules, here you can include or exclude items or sites but you have an additional option: “Required”. This option directs the search scope to require the rule query from every item in the scope. So if you add all content to the scope but the “Document” content type is required you will see only documents in the search result.
You can create rule that looks for a specific property. To add additional properties to this option you need to open the Metadata Property Mappings and find your property.
After that just switch the “Allow this property to be used in scopes” checkbox to “Yes”.
If you don’t find the property you are looking for in the list you need to add it to the list.
You can define that only site columns become a managed property. To do so, go to “Crawled Properties” and find your property (column) in the list (if it’s a site column it will be under the SharePoint folder).
Enter the property and verify that the “Include in Index” checkbox is checked. If not, check this option and run Incremental Crawl to see this property in your scope. Afterwards go once more to the "Metadata Property Mappings” page and create a new managed property.
Add mapping to the crawled property you created before and allow this property to be used in scopes. Now you can use this property in all search scopes.
Contextual Search Scope
Sometime you will see a scope named “This Site” or “This List”. These names signify that within the search scope there is a contextual search scope added by SharePoint.
This is a useful option when you want to enable your users to search only in the area they are working in at the time of their search (why waste precious time crawling other locations if you know that what you are searching for is somewhere within your current location?).
If you want to remove an existing contextual scope you may find this post useful:
http://littletalk.wordpress.com/2008/10/23/removing-contextual-this-sites-cope-from-simple-search-box/
If you like and use this function and you customized your search results page you may encounter some problems. You can’t really tell the contextual search scope to send a query to a customized results page. Contextual search scope always uses a default results page - _layouts/osssearchresults.aspx.
You can customize this page but if you have more than one SharePoint Portal the correct thing to do is to redirect your user to the appropriate, customized search results page. When the user types a search query and presses “Go” the search page redirects the query to the results page using URL parameters. In the address bar of the results page you can see parameters like “k”(search query) and “u”(URL). You need to redirect users from osssearchresults.asx page to customized results page using the same parameters. The "u” parameter can be indicator, pointing to the site from which the search query originated.
Below is code that will help you perform the redirection:
function getParam( name )
{
name = name.replace(/[[]/,"[").replace(/[]]/,"]");
var regexS = "[?&]"+name+"=([^&#]*)";
var regex = new RegExp( regexS );
var results = regex.exec( window.location.href );
if( results == null ) return "";
else return results[1];
}
function redirectTo()
{
urlTmp=getParam("u");
if(urlTmp.indexOf("site1url")>0)
{
window.location="http://customresultspageurl.aspx?k="+getParam("k")+"&cs="+getParam("cs")+"&u="+getParam("u");
}
}
redirectTo();
Just replace the “site1url” and “customresultspageurl” with your values and put this code into the osssearchresults.asx.
Coming next week:
Part 3 of the 3 part SharePoint Search Customization series: "Search Results" where we will discuss customization of your search results page.
About the Author
The KWizCom team utilizes their experience and knowledge to give fresh insight on Microsoft's SharePoint and CRM Products and Technologies...
Sveta Yerpilev is a SharePoint consultant and trainer for KWizCom Corporation. She is also a contributor on the KWizCom blog.
Mell kicks -another side- PV
![]() |
![]() JEHOVAH the Meaning Behind the Divine Name Book DVD US $2.79
|
![]() Bible Defense of Slavery and other Southern books on CD US $.01
|
![]() Remote trainer dog spray collar training control L3X US $60.92
|
![]() Scoped Shoulder Holster for THOMPSON CONTENDER 10 12 US $24.95
|
![]() Scoped Shoulder Holster for THOMPSON ENCORE PISTOLS US $24.95
|
![]() Molle Airsoft Versatile QD Drop Leg Pistol Holster Olive Drab US $19.99
|
![]() AC DC Battery ChargerGGSPen for Sony NP FM500H A700 US $12.48
|
![]() 49mm UV Ultra Violet Filter Lens Cap Pen Hood For Sony NEX5 NEX3 US $9.07
|
![]() NPFW50 BatteryPop Up HoodChargerPen for Sony NEX 5 US $22.27
|
![]() Tactical Utility Shoulder Pack Carrier Bag Pouch BK US $24.99
|
![]() Tactical Utility Shoulder Pack Bag Pouch Coyote Brown US $24.99
|
![]() X Ray Film Radiology Training Course Collection Bundle US $34.99
|
![]() FELLOWSHIP Untold Story of FRANK LLOYD WRIGHT Taliesin Fellowship 1st HC w DJ US $8.99
|
![]() NcStar M 1 A Scope Side Mount Weaver Style BLACK MM14 US $24.99
|
![]()
Optimum Nutrition Serious Mass
|
|
|
|
![]() |
Battlefield Bad Company 2 [Download]
List Price: |
![]() |
StarCraft Battle Chest
List Price: |
![]() |
ANNO 2070 [Download]
Sale Price: $49.99 |
![]() |
Streamlight 69230 TLR-2s Rail Mounted Strobing Tactical Light with Laser Sight and Rail Locating Keys
List Price: |
![]() |
Streamlight 74501 Strion Rechargeable Spotlight LED HP with 120V AC/12V DC (1) Holder
List Price: |
![]() |
Streamlight 14003 Sidewinder Green LED Flashlight, Green
List Price: |
![]() |
Star Wars Electronic Blaster Rifle BlasTech E-11 w/Light and Laser Sounds
Sale Price: $38.50 |
![]() |
Toy Gun m16A4 Electronic Sound Rifle With Scope
Sale Price: $21.95 |
![]() |
Star Wars Interactive R2D2 Astromech Droid Robot
Sale Price: $209.99 |
![]() |
War Inc. Battle Zone [Download]
Sale Price: $0.00 |
![]() |
CSI: Crime Scene Investigation Super Pack
List Price: |
![]() |
The Cherrytree Sessions
Sale Price: $14.58 |
![]() |
The Cherrytree Sessions
Sale Price: $9.00 |
![]() |
Stain
Sale Price: $4.95 |
![]() |
Nikon Buckmaster 6-18x40 Riflescope (SF Matte, BDC)
List Price: |
![]() |
40X63 CE Side Focus RIFLESCOPE-SPSCOPE63 |
![]() |
LensPEN Lens Cleaning System
List Price: |
![]() |
Simmons Truplex .22 Mag Riflescope (3-9X32, Matte)
List Price: |
![]() |
NcStar AR15 Carry Handle Adapter Weaver Mount 5½" (MAR5)
List Price: |



US $2.79







![Illadelph Halflife PA] by Roots The CD Sep 1996 DGC](http://www.shotrate.com/images/e/130698181067_0.jpg)









































































![Battlefield Bad Company 2 [Download]](http://www.shotrate.com/media/images/i/51JemHKmzjL._SL75_.jpg)

![ANNO 2070 [Download]](http://www.shotrate.com/media/images/i/516SnLD7MRL._SL75_.jpg)






![War Inc. Battle Zone [Download]](http://www.shotrate.com/media/images/i/51muGb2et7L._SL75_.jpg)








