{
    "Licensed Materials": "Property of HCL Technologies Limited. (c) Copyright HCL Technologies Limited 1996, 2022.",

    "_name": "This is the connector for a custom Rank indexing pipeline to perform incremental updates in the Authoring environment",
	"_usage": {
		"// This is the custom connector descriptor of a Rank connector to be used with HCL Commerce Ingest service.": ""
	},
    "name": "auth.rank",
	"environment": [ "auth", "data", "toolkit", "live" ],
	"description": "This is the connector to perform a Rank Near Real-time Update.  This operation involves only the Product indexing pipeline.",
    "pipes": [

		{
			"name": "NRTLink",
			"label": "NRTLink",
			"properties": [
				{
					"name": "Database Driver Location(s)",
					"value": "${AUTH_JDBC_DRIVER_LOCATION}",
					"scope": {
						"name": "Database Connection Pool",
						"type": "CONTROLLER_SERVICE"
					}
				},
				{
					"name": "Database Driver Class Name",
					"value": "${AUTH_JDBC_DRIVER_CLASSNAME}",
					"scope": {
						"name": "Database Connection Pool",
						"type": "CONTROLLER_SERVICE"
					}
				},
				{
					"name": "Database Connection URL",
					"value": "${AUTH_JDBC_URL}",
					"scope": {
						"name": "Database Connection Pool",
						"type": "CONTROLLER_SERVICE"
					}
				},
				{
					"name": "Database User",
					"value": "${AUTH_JDBC_USER_NAME}",
					"scope": {
						"name": "Database Connection Pool",
						"type": "CONTROLLER_SERVICE"
					}
				},
				{
					"name": "Password",
					"value": "${AUTH_JDBC_USER_PASSWORD}",
					"scope": {
						"name": "Database Connection Pool",
						"type": "CONTROLLER_SERVICE"
					}
				}
			]
		},
		{
			"name": "_Template-Index",
			"label": "Rank Schema",
			"properties": [
				{
					"name": "index.shard.size",
					"value": "1",
					"scope": {
						"name": "Setup Elasticsearch Index Schema",
						"type": "PROCESS_GROUP"
					}
				},
				{
                    "name": "index.replicas",
                    "value": "0",
                    "scope": {
                        "name": "Setup Elasticsearch Index Schema",
                        "type": "PROCESS_GROUP"
                    }
                },
				{
					"name": "index.store.type",
					"value": "mmapfs",
					"scope": {
						"name": "Setup Elasticsearch Index Schema",
						"type": "PROCESS_GROUP"
					}
				},
				{
					"name": "index.result.window",
					"value": "20000",
					"scope": {
						"name": "Setup Elasticsearch Index Schema",
						"type": "PROCESS_GROUP"
					}
				},
				{
					"name": "index.field.limit",
					"value": "300000",
					"scope": {
						"name": "Setup Elasticsearch Index Schema",
						"type": "PROCESS_GROUP"
					}
				}
			]
		},
		{
		    "// Updating product rank in Rank index": {
		    	"scroll.page.size": "SQL scroll page size",
		    	"scroll.bucket.size": "size of the batch response to be received within each SQL scroll page when extracting from the database"
            },
			"name": "_Template-DatabasePagingETL",
			"label": "Rank Stage 1",
			"properties": [
				{
					"name": "Database Driver Location(s)",
					"value": "${AUTH_JDBC_DRIVER_LOCATION}",
					"scope": {
						"name": "Database Connection Pool",
						"type": "CONTROLLER_SERVICE"
					}
				},
				{
					"name": "Database Driver Class Name",
					"value": "${AUTH_JDBC_DRIVER_CLASSNAME}",
					"scope": {
						"name": "Database Connection Pool",
						"type": "CONTROLLER_SERVICE"
					}
				},
				{
					"name": "Database Connection URL",
					"value": "${AUTH_JDBC_URL}",
					"scope": {
						"name": "Database Connection Pool",
						"type": "CONTROLLER_SERVICE"
					}
				},
				{
					"name": "Database User",
					"value": "${AUTH_JDBC_USER_NAME}",
					"scope": {
						"name": "Database Connection Pool",
						"type": "CONTROLLER_SERVICE"
					}
				},
				{
					"name": "Password",
					"value": "${AUTH_JDBC_USER_PASSWORD}",
					"scope": {
						"name": "Database Connection Pool",
						"type": "CONTROLLER_SERVICE"
					}
				},
				{
					"name": "properties.Entry Identifier",
					"value": "[id.catentry]",
					"scope": {
						"name": "Map Index Fields From Database.Transform Document - Map Index Fields From Database",
						"type": "PROCESSOR"
					}
				},
				{
					"name": "properties.Index Type",
					"value": "none",
					"scope": {
						"name": "Map Index Fields From Database.Transform Document - Map Index Fields From Database",
						"type": "PROCESSOR"
					}
				},
				{
					"name": "properties.Custom Index Name",
					"value": "auth.rank",
					"scope": {
						"name": "Map Index Fields From Database.Transform Document - Map Index Fields From Database",
						"type": "PROCESSOR"
					}
				},
				{
					"name": "properties.ingest.database.sql",
					"value": "SELECT FIELD1, CATENTRY_ID FROM CATENTRY WHERE FIELD1 IS NOT NULL ${paging.prefix} ${param.offset} ${paging.link} ${param.pageSize} ${paging.suffix}",
					"scope": {
						"name": "SCROLL SQL.Define custom SQL",
						"type": "PROCESSOR"
					}
				},
				{
					"name": "properties.CATENTRY_ID",
					"value": "id.catentry",
					"scope": {
						"name": "Map Index Fields From Database.Transform Document - Map Index Fields From Database",
						"type": "PROCESSOR"
					}
				},
				{
					"name": "properties.FIELD1",
					"value": "custom.rank.numeric",
					"scope": {
						"name": "Map Index Fields From Database.Transform Document - Map Index Fields From Database",
						"type": "PROCESSOR"
					}
				}
			]
		},
		{
			"// Wait for completion of all rank update operations before proceeding to the next stage": {
				"connector.stage.name": "name of the process group to monitor",
				"wait.error.limit": "define the error limit to stop or empty for no limit",
				"wait.method": "define whether to use event based trigger or to scan queue size"
			},
			"name": "WaitLink",
			"label": "WaitLink - Rank Stage 1",
			"properties": [
				{
					"name": "connector.stage.name",
					"value": "_Template-DatabasePagingETL",
					"scope": {
						"name": "Wait for Completion",
						"type": "PROCESS_GROUP"
					}
				},
				{
					"name": "wait.error.limit",
					"value": "10",
					"scope": {
						"name": "Wait for Completion",
						"type": "PROCESS_GROUP"
					}
				},
				{
					"name": "wait.method",
					"value": "event",
					"scope": {
						"name": "Wait for Completion",
						"type": "PROCESS_GROUP"
					}
				},
				{
					"name": "wait.flow.strategy",
					"value": "wait.id",
					"scope": {
						"name": "Wait for Completion",
						"type": "PROCESS_GROUP"
					}
				},
				{
					"name": "properties.Wait Strategy",
					"value": "wait.id",
					"scope": {
						"name": "Wait for Completion.Release matching documents",
						"type": "PROCESSOR"
					}
				}
			]
		},
        {
			"// Explicitly refresh the index searcher to pick up the latest updates": {
				"index.refresh.name": "name of the search index to be refreshed",
				"index.custom.name": "full name of the custom search index to be used instead"
			},
            "name": "RefreshLink",
            "label": "RefreshLink - Rank Stage 1",
            "properties": [
                {
                    "name": "index.custom.name",
                    "value": "auth.rank",
                    "scope": {
                        "name": "Refresh Index",
                        "type": "PROCESS_GROUP"
                    }
                }
            ]
        },
		{
		    "// Copying all ranks from Rank index back to Product index": {
		    	"environment.source.name": "the name of the environment where the source index comes from",
		    	"environment.target.name": "the name of the environment to copy the index to",
				"cache.channel.name": "the name of the local cache to be used to temporarily store the extracted data",
				"index.source.name": "the name of the source index for copying",
				"index.target.name": "the name of the target index for copying",
		        "scroll.page.size": "search query scroll page size",
		    	"scroll.bucket.size": "size of the batch response to be received within each scroll page",
		    	"scroll.duration": "the time period to retain the search context for scrolling"
		    },
			"name": "CopyLink",
			"label": "CopyLink - Rank (Copy To Product)",
			"properties": [
				{
					"name": "connector.stage.name",
					"value": "Rank Stage 2, Copy Ranks",
					"scope": {
						"name": "Prepare Copy",
						"type": "PROCESS_GROUP"
					}
				},
				{
                    "name": "cache.channel.name",
                    "value": "services/cache/nifi/Rank",
                    "scope": {
                        "name": "Copy Document",
                        "type": "PROCESS_GROUP"
                    }
                },
				{
                    "name": "cache.invalidation.template",
                    "value": "storeId:productId:[id.store]:[id.catentry]",
                    "scope": {
                        "name": "Copy Document",
                        "type": "PROCESS_GROUP"
                    }
                },
				{
                    "name": "cache.invalidation.channel",
                    "value": "baseCache",
                    "scope": {
                        "name": "Copy Document",
                        "type": "PROCESS_GROUP"
                    }
                },
				{
                    "name": "cache.invalidation.field",
                    "value": "custom.rank.numeric",
                    "scope": {
                        "name": "Copy Document",
                        "type": "PROCESS_GROUP"
                    }
                },
				{
                    "name": "environment.source.name",
                    "value": "auth",
                    "scope": {
                        "name": "Copy Document",
                        "type": "PROCESS_GROUP"
                    }
                },
				{
                    "name": "environment.target.name",
                    "value": "auth",
                    "scope": {
                        "name": "Copy Document",
                        "type": "PROCESS_GROUP"
                    }
                },
				{
                    "name": "index.source.name",
                    "value": "auth.rank",
                    "scope": {
                        "name": "Prepare Copy",
                        "type": "PROCESS_GROUP"
                    }
                },
				{
					"name": "properties.Route on default language",
					"value": "allow",
					"scope": {
						"name": "Extract Source Document.Route On Language",
						"type": "PROCESSOR"
					}
				},
				{
					"name": "properties.Route on other supported languages",
					"value": "allow",
					"scope": {
						"name": "Extract Source Document.Route On Language",
						"type": "PROCESSOR"
					}
				},
                {
					"name": "properties.Entry Identifier",
					"value": "${param.storeId}-${param.langId}-${param.catalogId}-[id.catentry]",
					"scope": {
						"name": "Extract Source Document.Extract Source Document",
						"type": "PROCESSOR"
					}
				},
				{
					"name": "properties.Replacement Value",
					"value": "{\"stored_fields\":[\"id.*\",\"custom.*\"],\"size\":${es.pageSize},\"_source\":false,\"query\":{\"bool\":{\"must\":{\"match_all\":{}}}}}",
					"scope": {
						"name": "SCROLL Elasticsearch.Generate query",
						"type": "PROCESSOR"
					}
				},
				{
					"name": "properties.Cache Invalidation Strategy",
					"value": "zero",
					"scope": {
						"name": "Update Target Document.Update Target Document",
						"type": "PROCESSOR"
					}
				}
			]
		},

		{
		    "// The connector dataflow terminates here by generating a log summary through the Logging Service": "",
			"name": "Terminal",
			"label": "Terminal"
		}
    ]
}
