@@ -12,6 +12,7 @@ VERSION_4=4.10.4
12
12
VERSION_5=5.5.4
13
13
VERSION_6=6.6.0
14
14
VERSION_7=7.6.0
15
+ VERSION_8=8.2.0
15
16
16
17
JAR_CORE_4=lucene-core-$VERSION_4 .jar
17
18
JAR_CORE_4_URL=http://central.maven.org/maven2/org/apache/lucene/lucene-core/$VERSION_4 /lucene-core-$VERSION_4 .jar
@@ -29,17 +30,21 @@ JAR_CORE_7=lucene-core-$VERSION_7.jar
29
30
JAR_CORE_7_URL=http://central.maven.org/maven2/org/apache/lucene/lucene-core/$VERSION_7 /lucene-core-$VERSION_7 .jar
30
31
JAR_BACK_7=lucene-backward-codecs-$VERSION_7 .jar
31
32
JAR_BACK_7_URL=http://central.maven.org/maven2/org/apache/lucene/lucene-backward-codecs/$VERSION_7 /lucene-backward-codecs-$VERSION_7 .jar
33
+ JAR_CORE_8=lucene-core-$VERSION_8 .jar
34
+ JAR_CORE_8_URL=http://central.maven.org/maven2/org/apache/lucene/lucene-core/$VERSION_8 /lucene-core-$VERSION_8 .jar
35
+ JAR_BACK_8=lucene-backward-codecs-$VERSION_8 .jar
36
+ JAR_BACK_8_URL=http://central.maven.org/maven2/org/apache/lucene/lucene-backward-codecs/$VERSION_8 /lucene-backward-codecs-$VERSION_8 .jar
32
37
BASEDIR=$( dirname " $0 " )
33
38
BACKUP=true
34
- TARGET=6
39
+ TARGET=8
35
40
while getopts " :st:" opt; do
36
41
case $opt in
37
42
s)
38
43
unset BACKUP
39
44
;;
40
45
t)
41
46
TARGET=$OPTARG
42
- if [ $TARGET -ge 4 ] && [ $TARGET -le 7 ] ; then
47
+ if [ $TARGET -ge 4 ] && [ $TARGET -le 8 ] ; then
43
48
echo " Target version is $TARGET "
44
49
else
45
50
echo " Invalid target version $TARGET , must be 5 or 6"
59
64
shift $(( $OPTIND - 1 ))
60
65
61
66
if [ X$1 == X ] ; then
62
- echo " Script to Upgrade old indices from 3.x -> 4.x -> 5.x -> 6.x -> 7.x format, so it can be used with Solr 6.x or 7 .x"
67
+ echo " Script to Upgrade old indices from 3.x -> 4.x -> 5.x -> 6.x -> 7.x -> 8.x format, so it can be used with Solr 6.x, 7.x, 8 .x"
63
68
echo " Usage: $0 [-s] [-t target-ver] <indexdata-root>"
64
69
echo
65
- echo " Example: $0 -t 6 /var/solr"
70
+ echo " Example: $0 -t 8 /var/solr"
66
71
echo " Please run the tool only on a cold index (no Solr running)"
67
72
echo " The script leaves a backup in <indexdata-root>/<core>/data/index_backup_<version>.tgz. Use -s to skip backup"
68
73
echo " Requires wget or curl to download dependencies"
@@ -82,7 +87,7 @@ if [[ ! -f ./$JAR_CORE_4 ]] ; then
82
87
exit 2
83
88
fi
84
89
fi
85
- for f in $JAR_BACK_4_URL $JAR_BACK_5_URL $JAR_BACK_6_URL $JAR_BACK_7_URL $JAR_CORE_4_URL $JAR_CORE_5_URL $JAR_CORE_6_URL $JAR_CORE_7_URL ; do
90
+ for f in $JAR_BACK_4_URL $JAR_BACK_5_URL $JAR_BACK_6_URL $JAR_BACK_7_URL $JAR_BACK_8_URL $ JAR_CORE_4_URL $JAR_CORE_5_URL $JAR_CORE_6_URL $JAR_CORE_7_URL $JAR_CORE_8_URL ; do
86
91
echo " Downloading $f "
87
92
$tool $f
88
93
done
@@ -94,7 +99,10 @@ CORES=$(for a in `find $DIR -name data`; do dirname $a; done);
94
99
95
100
function upgrade() {
96
101
INDEXDIR=$1
97
- ver=$( java -cp $BASEDIR /$JAR_CORE_7 :$BASEDIR /$JAR_BACK_7 org.apache.lucene.index.CheckIndex -fast $INDEXDIR | grep " version=" | sed -e ' s/.*=//g' | head -1)
102
+ ver=$( java -cp $BASEDIR /$JAR_CORE_8 :$BASEDIR /$JAR_BACK_8 org.apache.lucene.index.CheckIndex -fast $INDEXDIR | grep " version=" | sed -e ' s/.*=//g' | head -1)
103
+ if [ X$ver == X ] ; then
104
+ ver=$( java -cp $BASEDIR /$JAR_CORE_7 :$BASEDIR /$JAR_BACK_7 org.apache.lucene.index.CheckIndex -fast $INDEXDIR | grep " version=" | sed -e ' s/.*=//g' | head -1)
105
+ fi
98
106
if [ X$ver == X ] ; then
99
107
ver=$( java -cp $BASEDIR /$JAR_CORE_6 :$BASEDIR /$JAR_BACK_6 org.apache.lucene.index.CheckIndex -fast $INDEXDIR | grep " version=" | sed -e ' s/.*=//g' | head -1)
100
108
fi
@@ -123,8 +131,10 @@ function upgrade() {
123
131
CP=" $BASEDIR /$JAR_CORE_5 :$BASEDIR /$JAR_BACK_5 "
124
132
elif [ $majorVer -lt 6 ] ; then
125
133
CP=" $BASEDIR /$JAR_CORE_6 :$BASEDIR /$JAR_BACK_6 "
126
- else
127
- CP=" $BASEDIR /$JAR_CORE_7 :$BASEDIR /$JAR_BACK_7 "
134
+ elif [ $majorVer -lt 7 ] ; then
135
+ CP=" $BASEDIR /$JAR_CORE_7 :$BASEDIR /$JAR_BACK_7 "
136
+ else
137
+ CP=" $BASEDIR /$JAR_CORE_8 :$BASEDIR /$JAR_BACK_8 "
128
138
fi
129
139
if [ $majorVer -ge $TARGET ] ; then
130
140
echo " - Already on version $ver , not upgrading"
@@ -151,6 +161,11 @@ function upgrade() {
151
161
java -cp $BASEDIR /$JAR_CORE_7 :$BASEDIR /$JAR_BACK_7 org.apache.lucene.index.IndexUpgrader -delete-prior-commits $INDEXDIR
152
162
majorVer=7
153
163
fi
164
+ if [ $majorVer -lt 8 ] && [ $TARGET -ge 8 ] ; then
165
+ echo " - Upgrading 7.x -> 8.x"
166
+ java -cp $BASEDIR /$JAR_CORE_7 :$BASEDIR /$JAR_BACK_7 org.apache.lucene.index.IndexUpgrader -delete-prior-commits $INDEXDIR
167
+ majorVer=8
168
+ fi
154
169
fi
155
170
}
156
171
0 commit comments