Quantcast
Channel: SharePoint Diary
Viewing all articles
Browse latest Browse all 1058

Exclude SharePoint Site or List from Search Results

$
0
0
SharePoint search results are already security trimmed. Meaning, If an user doesn't has access to a SharePoint site, He/She doesn't see any search results from the particular site collection. Same applies to SharePoint lists even. But in some cases, you may want to prevent certain artifacts from appearing on the search results. E.g. You may want to exclude "Site Assets" library to exclude all images and supported scripts appearing in search!

Exclude site from search SharePoint 2013:
To exclude a SharePoint site from search results,
  • Click on "Search and offline availability" under Search group in Site settings page.
  • Choose "No" for Allow this site to appear in search results option.
  • Click on "OK" to save your changes.
SharePoint search exclude site collection
Set SharePoint Site collection to Exclude from Search Results using PowerShell:
Lets do it with PowerShell, instead of setting each subsites search visibility property manually.

Add-PSSnapin Microsoft.SharePoint.Powershell -ErrorAction SilentlyContinue

#Site collection URL
$SiteCollURL="http://mgmt.crescent.com/sites/reports"

#Get All sites under the given site collection
Get-SPSite $SiteCollURL | Get-SPWeb -Limit all | ForEach-Object {
Write-Host "Processing Web: $($_.ServerRelativeUrl)"

#Set Search visibility property to exclude the site from search
$_.NoCrawl = $true
$_.Update()

Write-Host "Updated Search Visibility on Web:" $_.Title -ForegroundColor Green
}
Please note, content from the given site collection and all of its sub-sites will not appear in search results after a search crawl (incremental or full) completed successfully!

Exclude list from SharePoint 2013 search:
Similarly on SharePoint lists and libraries, under Advanced settings, you have the search visibility option. To exclude all the items in the document library or list from appearing in to search results:
  • Navigate to the List or document library settings
  • Go to advanced settings
  • Set Search option to "No" to exclude document library or list from search in SharePoint, as seen below.
sharepoint 2013 search exclude list
PowerShell script to exclude list from SharePoint search
To exclude list items from SharePoint search results, you can set the NoCrawl Property!
$list.NoCrawl = $true

How about excluding aspx pages like AllItems.aspx, dispform.aspx, etc? Go for: SharePoint Search Crawl Rules

Viewing all articles
Browse latest Browse all 1058

Trending Articles