-
Notifications
You must be signed in to change notification settings - Fork 17
/
Copy pathprepare-solr
executable file
·41 lines (34 loc) · 1.04 KB
/
prepare-solr
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#!/usr/bin/env bash
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# create two Solr cores if the are not exist: <name>_1 and <name>_2
# Theit physical location will remain <name>_1 and <name>_2, but they
# will be accessible as <name> (for the current production)
# and <name>_dev for the new version which is just in the creation.
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
. ./solr-functions
DB=$1
CORE1=${DB}_1
CORE2=${DB}_2
CORE_PROD=${DB}
CORE_DEV=${DB}_dev
PROD_EXISTS=$(check_core "$CORE_PROD")
echo "$CORE_PROD exists: $PROD_EXISTS"
if [[ $PROD_EXISTS != 1 ]]; then
echo "Create Solr core '$CORE1'"
create_core "$CORE1"
prepare_schema "$CORE1"
rename_core "$CORE1" "$CORE_PROD"
fi
DEV_EXISTS=$(check_core "$CORE_DEV")
echo "$CORE_DEV exists: $DEV_EXISTS"
if [[ $DEV_EXISTS != 1 ]]; then
echo "Create Solr core '$CORE2'"
create_core "$CORE2"
prepare_schema "$CORE2"
rename_core "$CORE2" "$CORE_DEV"
fi
echo "Prepare schema"
prepare_schema "$CORE_DEV"
echo "Solr preparation DONE"