Skip to content

Commit

Permalink
Add exit messages and exit after failures
Browse files Browse the repository at this point in the history
  • Loading branch information
irisdianauy committed May 2, 2024
1 parent 0f527e1 commit 9c69836
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions bin/create-bioentities-suggesters.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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",
Expand Down Expand Up @@ -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",
Expand All @@ -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; }

0 comments on commit 9c69836

Please sign in to comment.