SharePoint 2013 Search =>Increase CutoffMaxBuckets size of the refiner
As we know by default refiner cut off max bucket size is 1000. So what if some time we as the developer wanted to increase it or having a requirement where we have more than 1000 refiners values.
In this scenario, if you
want to increase the size of the refiner you need to update the managed property
by using the following powershell command.
Full PowerShell code download from Github gist.
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 "**********************************************************************" |
Comments
Post a Comment