Created
December 25, 2016 07:15
-
-
Save BasantPandey/1f71d488f3e1ae56cc1922aee5c0aee7 to your computer and use it in GitHub Desktop.
Powershell to Set SetCutoffMaxBuckets value
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function LoadSharePointPowerShellEnvironment | |
{ | |
write-host "Setting up PowerShell environment for SharePoint..." -foregroundcolor Green | |
Add-PSSnapin "Microsoft.SharePoint.PowerShell" -ErrorAction SilentlyContinue | |
write-host "SharePoint PowerShell Snapin loaded." -foregroundcolor Green | |
} | |
function SetCutoffMaxBuckets($ManagedProperty,$CutoffMaxBuckets) | |
{ | |
try | |
{ | |
Write-Host "********Input Values ***************" -Fore green | |
Write-Output ("Managed Property Name: '$ManagedProperty'.") | |
Write-Output ("CutoffMaxBuckets Size: '$CutoffMaxBuckets'.") | |
Write-Host "*************************************" -Fore green | |
$mp = Get-SPEnterpriseSearchMetadataManagedProperty -SearchApplication $searchapp -Identity $ManagedProperty | |
if(-not $mp) | |
{ | |
Write-Host "Could not get Managed Property Name '$ManagedProperty'. Managed properties will not be configured." -Fore Red | |
return | |
} | |
if ($CutoffMaxBuckets -ne $null) | |
{ | |
#$mp.RefinerConfiguration.CutoffMaxBuckets | |
$mp.RefinerConfiguration.CutoffMaxBuckets = [int]$CutoffMaxBuckets | |
$mp.Update() | |
Write-Output ("Updated CutoffMaxBuckets size to: '$CutoffMaxBuckets'") | |
} | |
} | |
catch | |
{ | |
write-host $_.exception | |
} | |
} | |
LoadSharePointPowerShellEnvironment | |
$searchServiceName= "Search Service Application" | |
$searchapp = Get-SPEnterpriseSearchServiceApplication $searchServiceName | |
if (-not $searchapp) | |
{ | |
Write-Host "Could not get search application ($searchServiceName). Managed properties will not be configured." -Fore Red | |
return | |
} | |
Write-Host -ForegroundColor yellow "Process Start" | |
Write-Host -ForegroundColor yellow "**********************************************************************" | |
#SetCutoffMaxBuckets "ManagedPropertyName" #Value as integer 10000 | |
SetCutoffMaxBuckets "RefinerName" 10000 | |
$searchapp.Update() | |
Write-Host -ForegroundColor yellow "Process Complete" | |
Write-Host -ForegroundColor yellow "**********************************************************************" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment