From 9c698367950458b6218006ae673de0b01ed51a0b Mon Sep 17 00:00:00 2001 From: Iris Diana Yu Date: Thu, 2 May 2024 15:27:13 +0100 Subject: [PATCH] Add exit messages and exit after failures --- bin/create-bioentities-suggesters.sh | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/bin/create-bioentities-suggesters.sh b/bin/create-bioentities-suggesters.sh index 384cad7..2e54051 100755 --- a/bin/create-bioentities-suggesters.sh +++ b/bin/create-bioentities-suggesters.sh @@ -13,20 +13,20 @@ COLLECTION=${SOLR_COLLECTION:-"bioentities-v${SCHEMA_VERSION}"} ############################################################################################# printf "\n\nDelete search component for suggesters...\n" -curl $SOLR_AUTH -X POST -H 'Content-type:application/json' --data-binary '{ +curl "$SOLR_AUTH" -X POST -H 'Content-type:application/json' --data-binary '{ "delete-searchcomponent": "suggest" -}' http://${HOST}/solr/${COLLECTION}/config +}' "http://${HOST}/solr/${COLLECTION}/config" || { echo "Error: Failed to delete search component." >&2; exit 1; } printf "\n\nCreate empty search component for suggesters if it does not exist...\n" -curl $SOLR_AUTH -X POST -H 'Content-type:application/json' --data-binary '{ +curl "$SOLR_AUTH" -X POST -H 'Content-type:application/json' --data-binary '{ "add-searchcomponent": { "name": "suggest", "class": "solr.SuggestComponent" } -}' http://${HOST}/solr/${COLLECTION}/config +}' "http://${HOST}/solr/${COLLECTION}/config" || { echo "Error: Failed to create empty search component for suggesters." >&2; exit 1; } printf "\n\nClear suggester configuration for SCXA and GXA...\n" -curl $SOLR_AUTH -X POST -H 'Content-type:application/json' --data-binary '{ +curl "$SOLR_AUTH" -X POST -H 'Content-type:application/json' --data-binary '{ "update-searchcomponent": { "name": "suggest", "class": "solr.SuggestComponent", @@ -42,10 +42,10 @@ curl $SOLR_AUTH -X POST -H 'Content-type:application/json' --data-binary '{ } ] } -}' http://${HOST}/solr/${COLLECTION}/config +}' "http://${HOST}/solr/${COLLECTION}/config" || { echo "Error: Failed to clear suggester configuration for SCXA and GXA." >&2; exit 1; } printf "\n\nAdd suggester for GXA and SCXA...\n" -curl $SOLR_AUTH -X POST -H 'Content-type:application/json' --data-binary '{ +curl "$SOLR_AUTH" -X POST -H 'Content-type:application/json' --data-binary '{ "update-searchcomponent": { "name": "suggest", "class": "solr.SuggestComponent", @@ -92,17 +92,17 @@ curl $SOLR_AUTH -X POST -H 'Content-type:application/json' --data-binary '{ } ] } -}' http://${HOST}/solr/${COLLECTION}/config +}' "http://${HOST}/solr/${COLLECTION}/config" || { echo "Error: Failed to dd suggester for GXA and SCXA." >&2; exit 1; } ############################################################################################# printf "\n\nDelete request handler /suggest...\n" -curl $SOLR_AUTH -X POST -H 'Content-type:application/json' --data-binary '{ +curl "$SOLR_AUTH" -X POST -H 'Content-type:application/json' --data-binary '{ "delete-requesthandler" : "/suggest" -}' http://${HOST}/solr/${COLLECTION}/config +}' "http://${HOST}/solr/${COLLECTION}/config" || { echo "Error: Failed to elete drequest handler /suggest." >&2; exit 1; } printf "\n\nCreate request handler /suggest...\n" -curl $SOLR_AUTH -X POST -H 'Content-type:application/json' --data-binary '{ +curl "$SOLR_AUTH" -X POST -H 'Content-type:application/json' --data-binary '{ "add-requesthandler" : { "name": "/suggest", "class": "solr.SearchHandler", @@ -114,4 +114,4 @@ curl $SOLR_AUTH -X POST -H 'Content-type:application/json' --data-binary '{ }, "components": ["suggest"] } -}' http://${HOST}/solr/${COLLECTION}/config +}' "http://${HOST}/solr/${COLLECTION}/config" || { echo "Error: Failed to create request handler /suggest." >&2; exit 1; }