Skip to content

Commit

Permalink
Adjust some solr-functions to Solr9
Browse files Browse the repository at this point in the history
Most important to check whether a core already exists because then we
can prepreacte cores by other means outside of QA Catalugue. This
belongs to issue #580.

Adjusting schema with Solr9 has not been tried with success.
  • Loading branch information
nichtich committed Feb 4, 2025
1 parent 31bcd47 commit a6b6b57
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions solr-functions
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,13 @@ SOLR_HOST=${SOLR_HOST:-http://localhost:${PORT:-8983}}
check_core() {
LOCAL_CORE=$1
LOCAL_URL=$(printf "%s/solr/admin/cores?action=STATUS&core=%s" $SOLR_HOST $LOCAL_CORE)
CORE_EXISTS=$(curl -s "$LOCAL_URL" | jq .status | grep "\"$LOCAL_CORE\":" | grep -c -P '{$')
# use echo instead of return
echo $CORE_EXISTS
curl -s "$LOCAL_URL" | jq "if .status[]|keys|length>0 then 1 else 0 end"
}

create_core() {
LOCAL_CORE=$1
echo "creating Solr index: ${LOCAL_CORE} at $SOLR_HOST"
curl -s "$SOLR_HOST/solr/admin/cores?action=CREATE&name=$LOCAL_CORE&configSet=_default"
curl -s "$SOLR_HOST/solr/admin/cores?action=CREATE&name=$LOCAL_CORE&configSet=/opt/solr/server/solr/configsets/_default"
}

rename_core() {
Expand Down

0 comments on commit a6b6b57

Please sign in to comment.