1) Clean up inactive Query/Crawl topology from SSA
foreach($ssa in Get-SPEnterpriseSearchServiceApplication){
$ssa | get-SPenterpriseSearchCrawlTopology | where {$_.state -eq “Inactive”} | Remove-SPEnterpriseSearchCrawlTopology -confirm:$false
$ssa | get-SPenterpriseSearchQueryTopology | where {$_.state -eq “Inactive”} | Remove-SPEnterpriseSearchQueryTopology -confirm:$false
}
2) Setting up some initial variables.
$SSAName = "SSA1"
$SVCAcct = "contoso\spsvc"
$SSI = Get-SPEnterpriseSearchServiceInstance -local
$err = $null
3) Start Services search services for SSI
Start-SPEnterpriseSearchServiceInstance -Identity $SSI
4) Create an Application Pool.
$AppPool = new-SPServiceApplicationPool -name $SSAName"-AppPool" -account $SVCAcct
5) Create the SearchApplication and set it to a variable ( This might take couple minutes)
$SearchApp = New-SPEnterpriseSearchServiceApplication -Name $SSAName -applicationpool $AppPool -databasename $SSAName"_AdminDB"
6) Create search service application proxy
$SSAProxy = new-spenterprisesearchserviceapplicationproxy -name $SSAName"ApplicationProxy" -Uri $SearchApp.Uri.AbsoluteURI
7) Provision Search Admin Component. ( This might take couple minutes)
Set-SPEnterpriseSearchAdministrationComponent -searchapplication $SearchApp -searchserviceinstance $SSI
8) Create a new Crawl Topology.
$CrawlTopo = $SearchApp | New-SPEnterpriseSearchCrawlTopology
9) Set Crawl Store variable.
$CrawlStore = $SearchApp | Get-SPEnterpriseSearchCrawlDatabase
10) Create a new Crawl Component.
New-SPEnterpriseSearchCrawlComponent -CrawlTopology $CrawlTopo -CrawlDatabase $CrawlStore -SearchServiceInstance $SSI
11) Activate the Crawl Topology. ( This might take couple minutes)
do
{
$err = $null
$CrawlTopo | Set-SPEnterpriseSearchCrawlTopology -Active -ErrorVariable err
if ($CrawlTopo.State -eq "Active")
{
$err = $null
}
Start-Sleep -Seconds 10
}
until ($err -eq $null)
12) Create a new Query Topology.
$QueryTopo = $SearchApp | New-SPenterpriseSEarchQueryTopology -partitions 1
13) Set Query Partition variable
$Partition1 = ($QueryTopo | Get-SPEnterpriseSearchIndexPartition)
14) Create a Query Component.
New-SPEnterpriseSearchQueryComponent -indexpartition $Partition1 -QueryTopology $QueryTopo -SearchServiceInstance $SSI
15) Create a variable for the Property Store DB.
$PropDB = $SearchApp | Get-SPEnterpriseSearchPropertyDatabase
16) Set the Query Partition to use the Property Store DB.
$Partition1 | Set-SPEnterpriseSearchIndexPartition -PropertyDatabase $PropDB
17) Activate the Query Topology. ( This might take couple minutes)
do
{
$err = $null
$QueryTopo | Set-SPEnterpriseSearchQueryTopology -Active -ErrorVariable err -ErrorAction SilentlyContinue
Start-Sleep -Seconds 10
if ($QueryTopo.State -eq "Active")
{
$err = $null
}
}
until ($err -eq $null)
Write-host "Your search application $SSAName is now ready"
18) Remember to start SQSS service to make crawl and query work.
No comments:
Post a Comment