Friday, June 26, 2015

Exclude checkin comments

I had a request to hide checkin comments from searchresults in Sharepoint 2013. I decided to hide the column from the index.

This can be done from UI
  1. Central Administration>Search Service>Search Schema > Crawled Properties> Ows__checkinComment
  2. Uncheck Include in full-text index
  3. Full crawl

Or with powershell
------setCrawlPropCheckInComments.ps1-----

Add-PSSnapin microsoft.sharepoint.powershell
$name = "ows__CheckinComment"

$searchapp = get-spenterprisesearchserviceapplication

$crawledprop = Get-SPEnterpriseSearchMetadataCrawledProperty -SearchApplication $searchapp -Name $name
$crawledprop.IsMappedToContents = $false
$crawledprop.update()
----------------eof--------------------------------------------
And full crawl

-----------startFullCrawlOnAllContents.ps1----------------
Add-PSSnapin microsoft.sharepoint.powershell

$contents = get-spenterprisesearchcrawlcontentsource -SearchApplication "Search Service Application"

foreach ($content in $contents)
{
if ($content.crawlstatus -eq "Idle")
{
write-host "Idle, running crawl on $($content.name)"
$content.StartFullCrawl()
}
else {write-host "$($content.name) is not idle or on nogo-list" }

}
----------------------------eof--------------------------------------

One thing to keep in mind is if CheckInComments column is visible on any Views on the site, that view will be returned in results.

References:
http://www.synergyonline.com/Blog/Lists/Posts/Post.aspx?ID=242 
https://social.technet.microsoft.com/Forums/en-US/66c87e10-2e27-46e3-b176-27706f8e2fda/exclude-content-from-search-hithightlight-results?forum=sharepointgeneralprevious

No comments: