-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdevel-init-index.sh
More file actions
executable file
·64 lines (48 loc) · 1.22 KB
/
devel-init-index.sh
File metadata and controls
executable file
·64 lines (48 loc) · 1.22 KB
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#!/bin/bash
if [[ ! -f ./env ]]; then
>&2 echo "ERROR cannot find ./env";
exit;
fi
source ./env
SOLR_INDEX="$1";
if [ "x${SOLR_INDEX}" == "x" ]; then
>&2 echo "ERROR: ARGUMENT INDEX_NAME (CORE) EXPECTED";
echo ""
echo "available cores on solr:"
docker.sh solr_list_cores
if [[ -d ./cores/ ]]; then
echo "available cores on ./cores:"
for i in `ls ./cores/ -1`; do
echo " $i";
done
fi
exit 1;
else
if [ -f "./cores/${SOLR_INDEX}/ENV" ]; then
source "./cores/${SOLR_INDEX}/ENV"
fi
fi
if [ -z "${SOLR_SCHEMA}" ] || [ -z "${SOLR_INDEX}" ] ; then
if [ -z "${SOLR_INDEX}" ] ; then
echo "ERROR: ENV VARIABLE SOLR_INDEX MISSING";
fi
if [ -z "${SOLR_SCHEMA}" ] ; then
echo "ERROR: ENV VARIABLE SOLR_SCHEMA MISSING";
fi
exit 10;
fi
if [ "x${SOLR_SCHEMA}" == "x" ] ; then
echo "ERROR: ENV VARIABLE SOLR_SCHEMA MISSING";
exit 10;
fi
#make all
./drop-create-index.sh $SOLR_SCHEMA $SOLR_INDEX |tee /tmp/drop-create-index.out
ERROR_COUNT=`cat /tmp/drop-create-index.out|grep -i error|wc -l`
if [ "$ERROR_COUNT" != "0" ]; then
echo "ERROR INDEX NOT CREATED";
exit;
fi
echo "";
docker.sh solr_reload_index $SOLR_INDEX
echo "--"
docker.sh solr_show_core ${SOLR_INDEX}