Original

You are currently reviewing an older revision of this page.
Go to current version

Scopes Definition

A search scope defines a subset of information in the search index. Users can select a search scope when performing a search to restrict search results to the subset of information that they want. This can be very useful for an intranet with a high amount of documents. Users can refined their search and find any information many times easier.

Configuring Scopes

If you don't know how to manage or configure SharePoint Search Scopes please have a look at this URL : http://technet.microsoft.com/en-us/library/ee792872(v=office.14).aspx

 

Managing Scopes

If you already have a lot of scopes under SharePoint you can use PowerShell to get a list of them:

Orphan Search Scopes 
  • Run Powershell with Administrator Rights
  • Hit Get-SPEnterpriseSearchQueryScope
  • Provide your Search Service Application and hit Enter

You can get the all the scopes existing on your Search Service Application, but as you can see there are too much scopes on the Search Service Application on my environment.

Orphan Search Scopes 

When you restore a site and re-enable the feature who creates the Search Scopes or when you run a Content Deployment it’s quite possible that SharePoint recreates the Scopes. I had a total of 367 scopes. Quite impossible but still impressive…

So, if you want to delete all the “orphan” scopes you need to execute the following script!

$searchapp = Get-SPEnterpriseSearchServiceApplication “SEARCH SERVICE NAME”
  
$scopes=$searchapp | Get-SPEnterpriseSearchQueryScope | ? {$_.owningsite -eq $null -and $_.canbedeleted}| select name, owningsite ,canbedeleted
  
$scopes | % { $_.delete()}
Revert to this revision