Pipelines/Steps/Install/OnPrem/Sitecore/XM/Solr/9.2/PreInstalled/Add-CustomSolrConfigSets.ps1

$ErrorActionPreference = "Stop"

Write-Output "Add custom Solr config sets started..."

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

    foreach ($core in $SAFConfiguration.search.solr.customCores) {
        $solrParams = @{
            Path        = $configPath
            SolrRoot    = $SAFSolrTempDir
            CorePrefix  = $prefix  
            CoreName    = $core
        }
        Install-SitecoreConfiguration @solrParams
    }
}

Write-Output "Add custom Solr config sets done."