Skip to content

Commit

Permalink
Merge pull request #14 from ebi-gene-expression-group/feature/delete_…
Browse files Browse the repository at this point in the history
…searchcomponent

Delete existing search component for suggesters, to avoid errors when empty search component for suggesters cannot be created due to existing one.
  • Loading branch information
irisdianauy authored May 2, 2024
2 parents 2563422 + 9c69836 commit 6965e52
Showing 1 changed file with 15 additions and 10 deletions.
25 changes: 15 additions & 10 deletions bin/create-bioentities-suggesters.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,21 @@ 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 '{
"delete-searchcomponent": "suggest"
}' "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 @@ -37,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 @@ -87,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 @@ -109,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 6965e52

Please sign in to comment.