Thursday, November 12, 2015

PowerShell Script for adding FAST Search Crawl Rules in SharePoint 2010

Requirement: Define and add FAST Search crawl rules in SHarePoint 2010 through a PowerShell Script

Script:

                                                                                                                                                               

clear
Remove-PSSnapin Microsoft.FASTSearch.Powershell -ErrorAction SilentlyContinue
Remove-PSSnapin Microsoft.SharePoint.Powershell -ErrorAction SilentlyContinue
Add-PSSnapin Microsoft.FASTSearch.Powershell
Add-PSSnapin Microsoft.SharePoint.Powershell


##### Variables ####

$WebApplciationUrl = "http://webapplication"


#Exclusion Rules
$exRule1 = $WebApplciationUrl + "/*/Forms"
$exRule2 = $WebApplciationUrl + "/*.*.aspx(){1}"


#Inclusion Rules
$inRule1 = $WebApplciationUrl + "/sites/Project Deposit/_layouts/*.*(((records))|(Records))/.*"
$inRule2 = $WebApplciationUrl + "/sites/Project Deposit//*.*/((records)|(Records))(/)*.*"



$excludeRules = $exRule1,$exRule2
$includeRules = $inRule1,$inRule2


#Get Search service Application
$SearchServiceApp = Get-SPenterpriseSearchServiceApplication "FAST Content"
echo $SearchServiceApp

#Create Exclusion Crawl Rules
foreach($exItem in $excludeRules)
{
    New-SPEnterpriseSearchCrawlRule -SearchApplication $SearchServiceApp -Path $exItem -Type ExclusionRule -IsAdvancedRegularExpression $true ## -CrawlAsHttp 1
    write-host "Succesfully added exclusive rule: $exItem"
}

#Create Inclusion Crawl Rules
foreach($inItem in $includeRules)
{
    New-SPEnterpriseSearchCrawlRule -SearchApplication $SearchServiceApp -Path $inItem -Type InclusionRule -IsAdvancedRegularExpression $true
    write-host "Succesfully added inclusive rule: $inItem"
}


                                                                                                                                                               

No comments:

Post a Comment

Access to XMLHttpRequest at 'from origin has been blocked by CORS policy: Cross origin requests are only supported for protocol schemes: http, data, chrome, chrome-extension, https. .net core angular

Issue: The angular application was getting error from API that the origin has been blocked by CORS policy. Solution: Make sure that the...