Skip to content

Instantly share code, notes, and snippets.

@ishajain
Created June 20, 2014 07:07
Show Gist options
  • Select an option

  • Save ishajain/61c0b3b3a2190526f923 to your computer and use it in GitHub Desktop.

Select an option

Save ishajain/61c0b3b3a2190526f923 to your computer and use it in GitHub Desktop.
#Checking the Refiners refinable property for Managed Properties
Write-Host "Checking for refinable property for managed property" -ForegroundColor Yellow
$searchServiceApp=Get-SPEnterpriseSearchServiceApplication
$isFullCrawlRequired=$false;
#Custom Audience Managed Property
Write-Host "Checking refinable property for CustomAudience" -ForegroundColor Yellow
$audience= Get-SPEnterpriseSearchMetadataManagedProperty -SearchApplication $searchServiceApp | ? {$_.Name -eq "owstaxidCustomAudience"}
#Metadata Managed Property is always starts with owstaxid*
if($audience.Refinable -eq $false){
$audience.Refinable =$true
$audience.Update()
$isFullCrawlRequired=$true
}
if($isFullCrawlRequired -eq $false )
{
$customContentsources=Get-SPEnterpriseSearchCrawlContentSource -SearchApplication $searchServiceApp | ? {$_.Name -eq 'YourContentSourceName'}
if($customContentsources -ne $null)
{
Write-Host "Full crawl has started..." -ForegroundColor Yellow
$customContentsources.StartFullCrawl()
do {Start-Sleep -s 1} while ($customContentsources.CrawlStatus -ne "Idle")
Write-Host "Full crawl is completed successfully..." -ForegroundColor Green
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment