SharePoint 2010: Orphan Search Scopes

SharePoint 2010: Orphan Search Scopes

Definition Scopes

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 refine 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 all the scopes existing on your Search Service Application, but as you can see there are too much scopes on the Search Service Application in my environment.

Orphan Search Scopes 

When you restore a site and re-enable the feature what 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()}
Leave a Comment
  • Please add 1 and 7 and type the answer here:
  • Post
Wiki - Revision Comment List(Revision Comment)
Sort by: Published Date | Most Recent | Most Useful
Comments
  • Gokan Ozcifci edited Revision 1. Comment: Toc and content  

  • Naomi  N edited Original. Comment: Minor edit

Page 1 of 1 (2 items)
Wikis - Comment List
Sort by: Published Date | Most Recent | Most Useful
Posting comments is temporarily disabled until 10:00am PST on Saturday, December 14th. Thank you for your patience.
Comments
  • Naomi  N edited Original. Comment: Minor edit

  • Gokan Ozcifci edited Revision 1. Comment: Toc and content  

Page 1 of 1 (2 items)