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

{
    "Parameters": {
        "SolrRoot": {
            "Type": "string",
            "DefaultValue": "c:\\solr-7.2.1",
            "Description": "The file path to the Solr instance."
        },
        "BaseConfig": {
            "Type": "string",
            "DefaultValue": "_default",
            "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": {
            "Description": "Creates/clears core paths.",
            "Type": "EnsurePath",
            "Params": {
                "Clean": ["[variable('Custom.Root')]"]
            }
        },
        "PrepareCores": {
            "Description": "Copies base configs into the core paths.",
            "Type": "Copy",
            "Params": [
                {
                    "Source": "[joinpath(variable('Solr.BaseConfigs'), '*')]",
                    "Destination": "[variable('Custom.Root')]"
                }
            ]
        },
        "AddSchemaUniqueKeyField": {
            "Description": "Amends the core managed schema uniqueKey element.",
            "Type": "SetXml",
            "Params": [
                {
                    "FilePath": "[joinpath(variable('Custom.Conf'), variable('Solr.SchemaFileName'))]",
                    "Xpath": "[variable('Solr.Xpath.SchemaRoot')]",
                    "Element": "field",
                    "Attributes": "[variable('Solr.UniqueField.Attributes')]"
                }
            ]
        },
        "UpdateSchemaUniqueKey": {
            "Description": "Amends the core managed schema uniqueKey element.",
            "Type": "SetXml",
            "Params": [
                {
                    "FilePath": "[joinpath(variable('Custom.Conf'), 'managed-schema')]",
                    "Xpath": "[variable('Solr.Xpath.UniqueKey')]",
                    "Value": "[variable('Solr.UniqueField')]"
                }
            ]
        }
    }
}