Install/OnPrem/Solr/PreInstalled/Create-CustomSolrCoresViaHTTP.ps1

. "$PSScriptRoot\..\SolrParams.ps1" -Force
$ErrorActionPreference = "Stop"

Write-Output "Create custom Solr cores via HTTP started..."

if (($null -eq $global:Configuration.search.solr.customCores) -or ($global:Configuration.search.solr.customCores.Count -lt 1)) {
    Write-Warning "No custom Solr cores found."
}
else {
    $prefix = $global:Configuration.prefix
    $configPath = "$PSScriptRoot\custom-solrHTTP.json"

    foreach ($index in $global:Configuration.search.solr.customCores) {
        $solrParams = @{
            Path        = $configPath
            SolrUrl     = $SolrServiceURL
            CorePrefix  = $prefix  
            CoreName    = $index.name
        }
        Install-SitecoreConfiguration @solrParams
    }
}

Write-Output "Create custom Solr cores via HTTP done."