Searchable columns in SharePoint 2010

In this article we will be seeing about Searchable columns in SharePoint 2010.

You can exclude site columns from search and indexing. Go to Site Actions => Site Settings => Site Administration => Searchable Columns.

Using C# exclude columns:

using (SPSite site = new SPSite("http://servername:1111/")) { using (SPWeb web = site.RootWeb) { SPField field = web.Fields["_test"]; field.NoCrawl = true;                     field.Update();

} }

Using powershell exclude columns:

$site=Get-SPSite "http://servername:1111/" $web=$site.RootWeb $field=$web.Fields["_test"] $field.NoCrawl=$true $field.Update()