HCL Commerce Version 9.1.10.0 or later

Reading Search indices and profit margin values in a Live environment

How to use the Groovy ETL to fetch the Search Indices and Profit Margin values in a live environment.

Procedure

Use the following two methods in the Groovy ETL to get the Search Indices from the Profit Margin values in a live environment.
  1. Method 1: Use the Push-to-live command to copy the Auth Search Indices from the Profit Margin values in the live environment.
    1. Issue the following command from within a REST client:
      POST: https://CommerceServerName​​​:ts-app-port/wcs/resources/admin/index/dataImport/build?connectorId=push-to-live&storeId=1
    2. Check the build index status via the REST interface.
      GET: https://LiveCommerceServerName:ts-app-port/wcs/resources/admin/index/dataImport/status?jobStatusId=jobStatusId
      Note: In this example, jobStatusId is the value of the jobStatusId. Use basic authentication with the user name as spiuser and password as passw0rd for HCL Commerce 9.1.0.0 to 9.1.8.0, or QxV7uCk6RRiwvPVaa4wdD78jaHi2za8ssjneNMdu3vgqi for HCL Commerce 9.1.9.0 or greater.
    3. Follow the steps in Get connector descriptor of the existing connector and replace auth.reindex with live.reindex.
    4. Open the live.reindex connector descriptor JSON and paste the following profit margin connector code after the PriceStage pipe to customize the connector descriptor of the live.reindex connector with profit margin customization.
      {
      		"name": "ProfitMarginSchemaUpdateConnector"
      		},
      		{
      		"name": "ProfitMarginDatabaseConnectorPipe",
      		"properties": [
      			{
      				"name": "Database Driver Location(s)",
      				"value": "${LIVE_JDBC_DRIVER_LOCATION}",
      				"scope": {
      					"name": "Database Connection Pool", 
      					"type": "CONTROLLER_SERVICE"
      				}
      			},
      		{
      			"name": "Database Driver Class Name",
      			"value": "${LIVE_JDBC_DRIVER_CLASSNAME}",
      			"scope": {
      				"name": "Database Connection Pool",
      				"type": "CONTROLLER_SERVICE"
      			}
      		},
      		{
      			"name": "Database Connection URL",
      			"value": "${LIVE_JDBC_URL}",
      			"scope": {
      				"name": "Database Connection Pool",
      				"type": "CONTROLLER_SERVICE"
      			}
      		},
      		{
      			"name": "Database User",
      			"value": "${LIVE_JDBC_USER_NAME}",
      			"scope": {
      				"name": "Database Connection Pool",
      				"type": "CONTROLLER_SERVICE"
      			}
      		},
      		{
      			"name": "Password",
      			"value": "${LIVE_JDBC_USER_PASSWORD}",
      			"scope": {
      				"name": "Database Connection Pool",
      				"type": "CONTROLLER_SERVICE"
      			}
      		}
      	]
      	},
      
    5. Upgrade connector descriptor of the existing connector by replacing auth.reindex with live.reindex connector.
    6. Verify that the live.reindex connector is upgraded with Custom Profit Margin Process groups.
    7. To replicate the search index in a production environment, use the following command within a REST client.
      POST: https://CommerceServerName:ts-app-port/wcs/resources/admin/index/dataImport/build?connectorId=push-to-live&storeId=1
    8. Leave the Body empty, and use a basic authentication username as spiuser and password as spiuserPassword.
      Note: The default password is passw0rd. In the current example, the storeId is given as 1 (AuroraESite); replace this with the storeId for your own stores.
    9. Verify the status by using the following REST interface.
      GET: https://CommerceServerName:ts-app-port/wcs/resources/admin/index/dataImport/status?jobStatusId=jobStatusId
      Restrictions: If Catalog data changes are not available in your live stores after a push-to-live operation, trigger a WCT+ESINDEX invalidation operation when you make the update. For more information about the procedure and the caches to be updated, refer to Index changes are not reflected in storefront after Elasticsearch push-to-live. and make sure that the profit margin field is indexed.
  2. Method 2: Create a live search indices and profit margin values by building live.reindex connector.
    1. Repeat the steps 1 (a) iii, iv, v and vi given in method 1.
    2. Use the following command within a REST client.
      POST: https://LiveCommerceServerName:ts-app-port/wcs/resources/admin/index/dataImport/build?connectorId=live.reindex&storeId=1
    3. Check the build index status via the REST interface.
      GET: https://LiveCommerceServerName:ts-app-port/wcs/resources/admin/index/dataImport/status?jobStatusId=jobStatusId
      Note: In this example, jobStatusId is the value of the jobStatusId. Use basic authentication with the user name as spiuser and password as passw0rd for HCL Commerce 9.1.0.0 to 9.1.8.0, or QxV7uCk6RRiwvPVaa4wdD78jaHi2za8ssjneNMdu3vgqi for HCL Commerce 9.1.9.0 or greater.