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

$ErrorActionPreference = "Stop"

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

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

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

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