Pipelines/Steps/Install/OnPrem/Sitecore/XM/Solr/9.0/PreInstalled/custom-solrconfigset.json

{
    "Parameters": {
        "SolrRoot": {
            "Type": "string",
            "DefaultValue": "c:\\solr-6.6.2",
            "Description": "The file path to the Solr instance."
        },
        "BaseConfig": {
            "Type": "string",
            "DefaultValue": "basic_configs",
            "Description": "The configset to copy as a base for each core."
        },
        "CorePrefix": {
            "Type": "string",
            "DefaultValue": "sitecore",
            "Description": "The prefix for each of the created indexes."
        },
        "CoreName": {
            "Type": "string",
            "Description": "Name of custom core."
        }
    },
    "Variables": {
        "Solr.FullRoot": "[resolvepath(parameter('SolrRoot'))]",
        "Solr.Server": "[joinpath(variable('Solr.FullRoot'), 'server', 'solr')]",
        "Solr.BaseConfigs": "[joinpath(variable('Solr.Server'), 'configsets', parameter('BaseConfig'))]",
        "Solr.SchemaFileName": "managed-schema",
        "Solr.Xpath.SchemaRoot": "//schema",
        "Solr.Xpath.UniqueKey": "[concat(variable('Solr.Xpath.SchemaRoot'), '/uniqueKey')]",
        "Solr.UniqueField": "_uniqueid",
        "Solr.UniqueField.Attributes": {
            "name": "[variable('Solr.UniqueField')]",
            "type": "string",
            "indexed": "true",
            "required": "true",
            "stored": "true"
        },
        "Custom.Name": "[concat(parameter('CorePrefix'), '_', parameter('CoreName'))]",
        "Custom.Root": "[joinpath(variable('Solr.Server'), variable('Custom.Name'))]",
        "Custom.Conf": "[joinpath(variable('Custom.Root'), 'conf')]"
    },
    "Tasks": {
        "CleanCores": {
            "Type": "EnsurePath",
            "Params": {
                "Clean": [
                    "[variable('Custom.Root')]"
                ]
            }
        },
        "PrepareCores": {
            "Type": "Copy",
            "Params": [
                {
                    "Source": "[joinpath(variable('Solr.BaseConfigs'), '*')]",
                    "Destination": "[variable('Custom.Root')]"
                }
            ]
        },
        "AddSchemaUniqueKeyField": {
            "Type": "SetXml",
            "Params": [
                {
                    "FilePath": "[joinpath(variable('Custom.Conf'), variable('Solr.SchemaFileName'))]",
                    "Xpath": "[variable('Solr.Xpath.SchemaRoot')]",
                    "Element": "field",
                    "Attributes": "[variable('Solr.UniqueField.Attributes')]"
                }
            ]
        },
        "UpdateSchemaUniqueKey": {
            "Type": "SetXml",
            "Params": [
                {
                    "FilePath": "[joinpath(variable('Custom.Conf'), 'managed-schema')]",
                    "Xpath": "[variable('Solr.Xpath.UniqueKey')]",
                    "Value": "[variable('Solr.UniqueField')]"
                }
            ]
        }
    }
}