outoftime-sunspot 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +7 -0
- data/Manifest.txt +104 -0
- data/PostInstall.txt +7 -0
- data/README.rdoc +115 -0
- data/Rakefile +27 -0
- data/config/hoe.rb +74 -0
- data/config/requirements.rb +15 -0
- data/lib/light_config.rb +40 -0
- data/lib/sunspot/adapters.rb +54 -0
- data/lib/sunspot/conditions.rb +50 -0
- data/lib/sunspot/conditions_builder.rb +37 -0
- data/lib/sunspot/configuration.rb +17 -0
- data/lib/sunspot/field.rb +108 -0
- data/lib/sunspot/field_builder.rb +37 -0
- data/lib/sunspot/indexer.rb +65 -0
- data/lib/sunspot/query.rb +115 -0
- data/lib/sunspot/query_builder.rb +30 -0
- data/lib/sunspot/restriction.rb +72 -0
- data/lib/sunspot/scope_builder.rb +33 -0
- data/lib/sunspot/search.rb +83 -0
- data/lib/sunspot/session.rb +43 -0
- data/lib/sunspot/type.rb +62 -0
- data/lib/sunspot/util.rb +13 -0
- data/lib/sunspot/version.rb +10 -0
- data/lib/sunspot.rb +50 -0
- data/setup.rb +1585 -0
- data/solr/README.txt +36 -0
- data/solr/etc/jetty.xml +206 -0
- data/solr/etc/webdefault.xml +379 -0
- data/solr/exampledocs/books.csv +11 -0
- data/solr/exampledocs/hd.xml +46 -0
- data/solr/exampledocs/ipod_other.xml +50 -0
- data/solr/exampledocs/ipod_video.xml +35 -0
- data/solr/exampledocs/mem.xml +58 -0
- data/solr/exampledocs/monitor.xml +31 -0
- data/solr/exampledocs/monitor2.xml +30 -0
- data/solr/exampledocs/mp500.xml +39 -0
- data/solr/exampledocs/post.jar +0 -0
- data/solr/exampledocs/post.sh +28 -0
- data/solr/exampledocs/sd500.xml +33 -0
- data/solr/exampledocs/solr.xml +38 -0
- data/solr/exampledocs/spellchecker.xml +58 -0
- data/solr/exampledocs/utf8-example.xml +42 -0
- data/solr/exampledocs/vidcard.xml +52 -0
- data/solr/lib/jetty-6.1.3.jar +0 -0
- data/solr/lib/jetty-util-6.1.3.jar +0 -0
- data/solr/lib/jsp-2.1/ant-1.6.5.jar +0 -0
- data/solr/lib/jsp-2.1/core-3.1.1.jar +0 -0
- data/solr/lib/jsp-2.1/jsp-2.1.jar +0 -0
- data/solr/lib/jsp-2.1/jsp-api-2.1.jar +0 -0
- data/solr/lib/servlet-api-2.5-6.1.3.jar +0 -0
- data/solr/solr/README.txt +52 -0
- data/solr/solr/bin/abc +176 -0
- data/solr/solr/bin/abo +176 -0
- data/solr/solr/bin/backup +108 -0
- data/solr/solr/bin/backupcleaner +142 -0
- data/solr/solr/bin/commit +128 -0
- data/solr/solr/bin/optimize +129 -0
- data/solr/solr/bin/readercycle +129 -0
- data/solr/solr/bin/rsyncd-disable +77 -0
- data/solr/solr/bin/rsyncd-enable +76 -0
- data/solr/solr/bin/rsyncd-start +145 -0
- data/solr/solr/bin/rsyncd-stop +105 -0
- data/solr/solr/bin/scripts-util +83 -0
- data/solr/solr/bin/snapcleaner +148 -0
- data/solr/solr/bin/snapinstaller +168 -0
- data/solr/solr/bin/snappuller +248 -0
- data/solr/solr/bin/snappuller-disable +77 -0
- data/solr/solr/bin/snappuller-enable +77 -0
- data/solr/solr/bin/snapshooter +109 -0
- data/solr/solr/conf/admin-extra.html +31 -0
- data/solr/solr/conf/protwords.txt +21 -0
- data/solr/solr/conf/schema.xml +231 -0
- data/solr/solr/conf/scripts.conf +24 -0
- data/solr/solr/conf/solrconfig.xml +394 -0
- data/solr/solr/conf/stopwords.txt +57 -0
- data/solr/solr/conf/synonyms.txt +31 -0
- data/solr/start.jar +0 -0
- data/solr/webapps/solr.war +0 -0
- data/tasks/deployment.rake +34 -0
- data/tasks/environment.rake +7 -0
- data/tasks/rcov.rake +6 -0
- data/tasks/solr.rake +12 -0
- data/tasks/website.rake +17 -0
- data/test/api/test_build_search.rb +216 -0
- data/test/api/test_helper.rb +4 -0
- data/test/api/test_indexer.rb +110 -0
- data/test/api/test_retrieve_search.rb +114 -0
- data/test/api/test_session.rb +46 -0
- data/test/custom_expectation.rb +53 -0
- data/test/integration/test_field_types.rb +62 -0
- data/test/integration/test_helper.rb +1 -0
- data/test/integration/test_keyword_search.rb +32 -0
- data/test/integration/test_pagination.rb +32 -0
- data/test/mocks/base_class.rb +2 -0
- data/test/mocks/comment.rb +28 -0
- data/test/mocks/mock_adapter.rb +25 -0
- data/test/mocks/post.rb +41 -0
- data/test/test_helper.rb +31 -0
- metadata +191 -0
@@ -0,0 +1,248 @@
|
|
1
|
+
#!/bin/bash
|
2
|
+
#
|
3
|
+
# Licensed to the Apache Software Foundation (ASF) under one or more
|
4
|
+
# contributor license agreements. See the NOTICE file distributed with
|
5
|
+
# this work for additional information regarding copyright ownership.
|
6
|
+
# The ASF licenses this file to You under the Apache License, Version 2.0
|
7
|
+
# (the "License"); you may not use this file except in compliance with
|
8
|
+
# the License. You may obtain a copy of the License at
|
9
|
+
#
|
10
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
11
|
+
#
|
12
|
+
# Unless required by applicable law or agreed to in writing, software
|
13
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
14
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
15
|
+
# See the License for the specific language governing permissions and
|
16
|
+
# limitations under the License.
|
17
|
+
#
|
18
|
+
# Shell script to copy snapshots of a Solr Lucene collection from the master
|
19
|
+
|
20
|
+
orig_dir=$(pwd)
|
21
|
+
cd ${0%/*}/..
|
22
|
+
solr_root=$(pwd)
|
23
|
+
cd ${orig_dir}
|
24
|
+
|
25
|
+
unset master_host rsyncd_port master_data_dir master_status_dir snap_name
|
26
|
+
unset sizeonly stats data_dir user verbose debug compress startStatus
|
27
|
+
. ${solr_root}/bin/scripts-util
|
28
|
+
|
29
|
+
# set up variables
|
30
|
+
prog=${0##*/}
|
31
|
+
log=${solr_root}/logs/${prog}.log
|
32
|
+
|
33
|
+
# define usage string
|
34
|
+
USAGE="\
|
35
|
+
usage: $prog [-M master] [-P portnum] [-D mdir] [-S sdir] [-n snapshot] [-d dir] [-u username] [-svz]
|
36
|
+
-M master specify hostname of master server from where to pull index
|
37
|
+
snapshot
|
38
|
+
-P port specify rsyncd port number of master server from where to
|
39
|
+
pull index snapshot
|
40
|
+
-D specify directory holding index data on master server
|
41
|
+
-S specify directory holding snapshot status on master server
|
42
|
+
-n snapshot pull a specific snapshot by name
|
43
|
+
-d specify directory holding index data on local machine
|
44
|
+
-u specify user to sudo to before running script
|
45
|
+
-s use the --size-only option with rsync
|
46
|
+
-v increase verbosity (-vv show file transfer stats also)
|
47
|
+
-V output debugging info
|
48
|
+
-z enable compression of data
|
49
|
+
"
|
50
|
+
|
51
|
+
# parse args
|
52
|
+
while getopts M:P:D:S:n:d:u:svVz OPTION
|
53
|
+
do
|
54
|
+
case $OPTION in
|
55
|
+
M)
|
56
|
+
master_host="$OPTARG"
|
57
|
+
;;
|
58
|
+
P)
|
59
|
+
rsyncd_port="$OPTARG"
|
60
|
+
;;
|
61
|
+
D)
|
62
|
+
master_data_dir="$OPTARG"
|
63
|
+
;;
|
64
|
+
S)
|
65
|
+
master_status_dir="$OPTARG"
|
66
|
+
;;
|
67
|
+
n)
|
68
|
+
snap_name="$OPTARG"
|
69
|
+
;;
|
70
|
+
d)
|
71
|
+
data_dir="$OPTARG"
|
72
|
+
;;
|
73
|
+
u)
|
74
|
+
user="$OPTARG"
|
75
|
+
;;
|
76
|
+
s)
|
77
|
+
sizeonly="--size-only"
|
78
|
+
;;
|
79
|
+
v)
|
80
|
+
[[ -n $verbose ]] && stats="--stats" || verbose=v
|
81
|
+
;;
|
82
|
+
V)
|
83
|
+
debug="V"
|
84
|
+
;;
|
85
|
+
z)
|
86
|
+
compress="z"
|
87
|
+
;;
|
88
|
+
*)
|
89
|
+
echo "$USAGE"
|
90
|
+
exit 1
|
91
|
+
esac
|
92
|
+
done
|
93
|
+
|
94
|
+
[[ -n $debug ]] && set -x
|
95
|
+
|
96
|
+
if [[ -z ${master_host} ]]
|
97
|
+
then
|
98
|
+
echo "name of master server missing in $confFile or command line."
|
99
|
+
echo "$USAGE"
|
100
|
+
exit 1
|
101
|
+
fi
|
102
|
+
|
103
|
+
# try to determine rsyncd port number from $confFile if not specified on
|
104
|
+
# command line, default to solr_port+10000
|
105
|
+
if [[ -z ${rsyncd_port} ]]
|
106
|
+
then
|
107
|
+
if [[ "${solr_port}" ]]
|
108
|
+
then
|
109
|
+
rsyncd_port=`expr 10000 + ${solr_port}`
|
110
|
+
else
|
111
|
+
echo "rsyncd port number of master server missing in $confFile or command line."
|
112
|
+
echo "$USAGE"
|
113
|
+
exit 1
|
114
|
+
fi
|
115
|
+
fi
|
116
|
+
|
117
|
+
if [[ -z ${master_data_dir} ]]
|
118
|
+
then
|
119
|
+
echo "directory holding index data on master server missing in $confFile or command line."
|
120
|
+
echo "$USAGE"
|
121
|
+
exit 1
|
122
|
+
fi
|
123
|
+
|
124
|
+
if [[ -z ${master_status_dir} ]]
|
125
|
+
then
|
126
|
+
echo "directory holding snapshot status on master server missing in $confFile or command line."
|
127
|
+
echo "$USAGE"
|
128
|
+
exit 1
|
129
|
+
fi
|
130
|
+
|
131
|
+
fixUser "$@"
|
132
|
+
|
133
|
+
# use default value for data_dir if not specified
|
134
|
+
# relative path starts at ${solr_root}
|
135
|
+
if [[ -z ${data_dir} ]]
|
136
|
+
then
|
137
|
+
data_dir=${solr_root}/data
|
138
|
+
elif [[ "`echo ${data_dir}|cut -c1`" != "/" ]]
|
139
|
+
then
|
140
|
+
data_dir=${solr_root}/${data_dir}
|
141
|
+
fi
|
142
|
+
|
143
|
+
# assume relative path to start at ${solr_root}
|
144
|
+
if [[ "`echo ${master_data_dir}|cut -c1`" != "/" ]]
|
145
|
+
then
|
146
|
+
master_data_dir=${solr_root}/${master_data_dir}
|
147
|
+
fi
|
148
|
+
if [[ "`echo ${master_status_dir}|cut -c1`" != "/" ]]
|
149
|
+
then
|
150
|
+
master_status_dir=${solr_root}/${master_status_dir}
|
151
|
+
fi
|
152
|
+
|
153
|
+
# push stats/state to master if necessary
|
154
|
+
function pushStatus
|
155
|
+
{
|
156
|
+
scp -q -o StrictHostKeyChecking=no ${solr_root}/logs/snappuller.status ${master_host}:${master_status_dir}/snapshot.status.`uname -n`
|
157
|
+
}
|
158
|
+
|
159
|
+
start=`date +"%s"`
|
160
|
+
|
161
|
+
logMessage started by $oldwhoami
|
162
|
+
logMessage command: $0 $@
|
163
|
+
|
164
|
+
if [[ ! -f ${solr_root}/logs/snappuller-enabled ]]
|
165
|
+
then
|
166
|
+
logMessage snappuller disabled
|
167
|
+
exit 1
|
168
|
+
fi
|
169
|
+
|
170
|
+
# make sure we can ssh to master
|
171
|
+
if
|
172
|
+
! ssh -o StrictHostKeyChecking=no ${master_host} id 1>/dev/null 2>&1
|
173
|
+
then
|
174
|
+
logMessage failed to ssh to master ${master_host}
|
175
|
+
exit 1
|
176
|
+
fi
|
177
|
+
|
178
|
+
# get directory name of latest snapshot if not specified on command line
|
179
|
+
if [[ -z ${snap_name} ]]
|
180
|
+
then
|
181
|
+
snap_name=`ssh -o StrictHostKeyChecking=no ${master_host} "ls ${master_data_dir}|grep 'snapshot\.'|grep -v wip|sort -r|head -1"`
|
182
|
+
fi
|
183
|
+
if [[ "${snap_name}" == "" ]]
|
184
|
+
then
|
185
|
+
logMessage no snapshot available on ${master_host} in ${master_data_dir}
|
186
|
+
logExit ended 0
|
187
|
+
else
|
188
|
+
name=`basename ${snap_name}`
|
189
|
+
fi
|
190
|
+
|
191
|
+
# clean up after INT/TERM
|
192
|
+
trap 'echo cleaning up, please wait ...;/bin/rm -rf ${data_dir}/${name} ${data_dir}/${name}-wip;echo ${startStatus} aborted:$(timeStamp)>${solr_root}/logs/snappuller.status;pushStatus;logExit aborted 13' INT TERM
|
193
|
+
|
194
|
+
if [[ -d ${data_dir}/${name} || -d ${data_dir}/${name}-wip ]]
|
195
|
+
then
|
196
|
+
logMessage no new snapshot available on ${master_host} in ${master_data_dir}
|
197
|
+
logExit ended 0
|
198
|
+
fi
|
199
|
+
|
200
|
+
# take a snapshot of current index so that only modified files will be rsync-ed
|
201
|
+
# put the snapshot in the 'work-in-progress" directory to prevent it from
|
202
|
+
# being installed while the copying is still in progress
|
203
|
+
cp -lr ${data_dir}/index ${data_dir}/${name}-wip
|
204
|
+
# force rsync of segments and .del files since we are doing size-only
|
205
|
+
if [[ -n ${sizeonly} ]]
|
206
|
+
then
|
207
|
+
rm -f ${data_dir}/${name}-wip/segments
|
208
|
+
rm -f ${data_dir}/${name}-wip/*.del
|
209
|
+
fi
|
210
|
+
|
211
|
+
logMessage pulling snapshot ${name}
|
212
|
+
|
213
|
+
# make sure master has directory for hold slaves stats/state
|
214
|
+
ssh -o StrictHostKeyChecking=no ${master_host} mkdir -p ${master_status_dir}
|
215
|
+
|
216
|
+
# start new distribution stats
|
217
|
+
rsyncStart=`date`
|
218
|
+
startTimestamp=`date -d "$rsyncStart" +'%Y%m%d-%H%M%S'`
|
219
|
+
rsyncStartSec=`date -d "$rsyncStart" +'%s'`
|
220
|
+
startStatus="rsync of `basename ${name}` started:$startTimestamp"
|
221
|
+
echo ${startStatus} > ${solr_root}/logs/snappuller.status
|
222
|
+
pushStatus
|
223
|
+
|
224
|
+
# rsync over files that have changed
|
225
|
+
rsync -Wa${verbose}${compress} --delete ${sizeonly} \
|
226
|
+
${stats} rsync://${master_host}:${rsyncd_port}/solr/${name}/ ${data_dir}/${name}-wip
|
227
|
+
|
228
|
+
rc=$?
|
229
|
+
rsyncEnd=`date`
|
230
|
+
endTimestamp=`date -d "$rsyncEnd" +'%Y%m%d-%H%M%S'`
|
231
|
+
rsyncEndSec=`date -d "$rsyncEnd" +'%s'`
|
232
|
+
elapsed=`expr $rsyncEndSec - $rsyncStartSec`
|
233
|
+
if [[ $rc != 0 ]]
|
234
|
+
then
|
235
|
+
logMessage rsync failed
|
236
|
+
/bin/rm -rf ${data_dir}/${name}-wip
|
237
|
+
echo ${startStatus} failed:$endTimestamp > ${solr_root}/logs/snappuller.status
|
238
|
+
pushStatus
|
239
|
+
logExit failed 1
|
240
|
+
fi
|
241
|
+
|
242
|
+
# move into place atomically
|
243
|
+
mv ${data_dir}/${name}-wip ${data_dir}/${name}
|
244
|
+
|
245
|
+
# finish new distribution stats`
|
246
|
+
echo ${startStatus} ended:$endTimestamp rsync-elapsed:${elapsed} > ${solr_root}/logs/snappuller.status
|
247
|
+
pushStatus
|
248
|
+
logExit ended 0
|
@@ -0,0 +1,77 @@
|
|
1
|
+
#!/bin/bash
|
2
|
+
#
|
3
|
+
# Licensed to the Apache Software Foundation (ASF) under one or more
|
4
|
+
# contributor license agreements. See the NOTICE file distributed with
|
5
|
+
# this work for additional information regarding copyright ownership.
|
6
|
+
# The ASF licenses this file to You under the Apache License, Version 2.0
|
7
|
+
# (the "License"); you may not use this file except in compliance with
|
8
|
+
# the License. You may obtain a copy of the License at
|
9
|
+
#
|
10
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
11
|
+
#
|
12
|
+
# Unless required by applicable law or agreed to in writing, software
|
13
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
14
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
15
|
+
# See the License for the specific language governing permissions and
|
16
|
+
# limitations under the License.
|
17
|
+
#
|
18
|
+
# Shell script to disable snappuller
|
19
|
+
|
20
|
+
orig_dir=$(pwd)
|
21
|
+
cd ${0%/*}/..
|
22
|
+
solr_root=$(pwd)
|
23
|
+
cd ${orig_dir}
|
24
|
+
|
25
|
+
unset user verbose debug
|
26
|
+
. ${solr_root}/bin/scripts-util
|
27
|
+
|
28
|
+
# set up variables
|
29
|
+
prog=${0##*/}
|
30
|
+
log=${solr_root}/logs/snappuller.log
|
31
|
+
|
32
|
+
# define usage string
|
33
|
+
USAGE="\
|
34
|
+
usage: $prog [-u username] [-v]
|
35
|
+
-u specify user to sudo to before running script
|
36
|
+
-v increase verbosity
|
37
|
+
-V output debugging info
|
38
|
+
"
|
39
|
+
|
40
|
+
# parse args
|
41
|
+
while getopts u:vV OPTION
|
42
|
+
do
|
43
|
+
case $OPTION in
|
44
|
+
u)
|
45
|
+
user="$OPTARG"
|
46
|
+
;;
|
47
|
+
v)
|
48
|
+
verbose="v"
|
49
|
+
;;
|
50
|
+
V)
|
51
|
+
debug="V"
|
52
|
+
;;
|
53
|
+
*)
|
54
|
+
echo "$USAGE"
|
55
|
+
exit 1
|
56
|
+
esac
|
57
|
+
done
|
58
|
+
|
59
|
+
[[ -n $debug ]] && set -x
|
60
|
+
|
61
|
+
fixUser "$@"
|
62
|
+
|
63
|
+
start=`date +"%s"`
|
64
|
+
|
65
|
+
logMessage disabled by $oldwhoami
|
66
|
+
logMessage command: $0 $@
|
67
|
+
name=${solr_root}/logs/snappuller-enabled
|
68
|
+
|
69
|
+
if [[ -f ${name} ]]
|
70
|
+
then
|
71
|
+
rm -f ${name}
|
72
|
+
else
|
73
|
+
logMessage snappuller not currently enabled
|
74
|
+
logExit exited 1
|
75
|
+
fi
|
76
|
+
|
77
|
+
logExit ended 0
|
@@ -0,0 +1,77 @@
|
|
1
|
+
#!/bin/bash
|
2
|
+
#
|
3
|
+
# Licensed to the Apache Software Foundation (ASF) under one or more
|
4
|
+
# contributor license agreements. See the NOTICE file distributed with
|
5
|
+
# this work for additional information regarding copyright ownership.
|
6
|
+
# The ASF licenses this file to You under the Apache License, Version 2.0
|
7
|
+
# (the "License"); you may not use this file except in compliance with
|
8
|
+
# the License. You may obtain a copy of the License at
|
9
|
+
#
|
10
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
11
|
+
#
|
12
|
+
# Unless required by applicable law or agreed to in writing, software
|
13
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
14
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
15
|
+
# See the License for the specific language governing permissions and
|
16
|
+
# limitations under the License.
|
17
|
+
#
|
18
|
+
# Shell script to enable snappuller
|
19
|
+
|
20
|
+
orig_dir=$(pwd)
|
21
|
+
cd ${0%/*}/..
|
22
|
+
solr_root=$(pwd)
|
23
|
+
cd ${orig_dir}
|
24
|
+
|
25
|
+
unset user verbose debug
|
26
|
+
. ${solr_root}/bin/scripts-util
|
27
|
+
|
28
|
+
# set up variables
|
29
|
+
prog=${0##*/}
|
30
|
+
log=${solr_root}/logs/snappuller.log
|
31
|
+
|
32
|
+
# define usage string
|
33
|
+
USAGE="\
|
34
|
+
usage: $prog [-u username] [-v]
|
35
|
+
-u specify user to sudo to before running script
|
36
|
+
-v increase verbosity
|
37
|
+
-V output debugging info
|
38
|
+
"
|
39
|
+
|
40
|
+
# parse args
|
41
|
+
while getopts u:vV OPTION
|
42
|
+
do
|
43
|
+
case $OPTION in
|
44
|
+
u)
|
45
|
+
user="$OPTARG"
|
46
|
+
;;
|
47
|
+
v)
|
48
|
+
verbose="v"
|
49
|
+
;;
|
50
|
+
V)
|
51
|
+
debug="V"
|
52
|
+
;;
|
53
|
+
*)
|
54
|
+
echo "$USAGE"
|
55
|
+
exit 1
|
56
|
+
esac
|
57
|
+
done
|
58
|
+
|
59
|
+
[[ -n $debug ]] && set -x
|
60
|
+
|
61
|
+
fixUser "$@"
|
62
|
+
|
63
|
+
start=`date +"%s"`
|
64
|
+
|
65
|
+
logMessage enabled by $oldwhoami
|
66
|
+
logMessage command: $0 $@
|
67
|
+
name=${solr_root}/logs/snappuller-enabled
|
68
|
+
|
69
|
+
if [[ -f ${name} ]]
|
70
|
+
then
|
71
|
+
logMessage snappuller already currently enabled
|
72
|
+
logExit exited 1
|
73
|
+
else
|
74
|
+
touch ${name}
|
75
|
+
fi
|
76
|
+
|
77
|
+
logExit ended 0
|
@@ -0,0 +1,109 @@
|
|
1
|
+
#!/bin/bash
|
2
|
+
#
|
3
|
+
# Licensed to the Apache Software Foundation (ASF) under one or more
|
4
|
+
# contributor license agreements. See the NOTICE file distributed with
|
5
|
+
# this work for additional information regarding copyright ownership.
|
6
|
+
# The ASF licenses this file to You under the Apache License, Version 2.0
|
7
|
+
# (the "License"); you may not use this file except in compliance with
|
8
|
+
# the License. You may obtain a copy of the License at
|
9
|
+
#
|
10
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
11
|
+
#
|
12
|
+
# Unless required by applicable law or agreed to in writing, software
|
13
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
14
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
15
|
+
# See the License for the specific language governing permissions and
|
16
|
+
# limitations under the License.
|
17
|
+
#
|
18
|
+
# Shell script to take a snapshot of a Solr Lucene collection.
|
19
|
+
|
20
|
+
orig_dir=$(pwd)
|
21
|
+
cd ${0%/*}/..
|
22
|
+
solr_root=$(pwd)
|
23
|
+
cd ${orig_dir}
|
24
|
+
|
25
|
+
unset data_dir user verbose debug
|
26
|
+
. ${solr_root}/bin/scripts-util
|
27
|
+
|
28
|
+
# set up variables
|
29
|
+
prog=${0##*/}
|
30
|
+
log=${solr_root}/logs/${prog}.log
|
31
|
+
|
32
|
+
# define usage string
|
33
|
+
USAGE="\
|
34
|
+
usage: $prog [-d dir] [-u username] [-v]
|
35
|
+
-d specify directory holding index data
|
36
|
+
-u specify user to sudo to before running script
|
37
|
+
-v increase verbosity
|
38
|
+
-V output debugging info
|
39
|
+
"
|
40
|
+
|
41
|
+
# parse args
|
42
|
+
while getopts d:u:vV OPTION
|
43
|
+
do
|
44
|
+
case $OPTION in
|
45
|
+
d)
|
46
|
+
data_dir="$OPTARG"
|
47
|
+
;;
|
48
|
+
u)
|
49
|
+
user="$OPTARG"
|
50
|
+
;;
|
51
|
+
v)
|
52
|
+
verbose="v"
|
53
|
+
;;
|
54
|
+
V)
|
55
|
+
debug="V"
|
56
|
+
;;
|
57
|
+
*)
|
58
|
+
echo "$USAGE"
|
59
|
+
exit 1
|
60
|
+
esac
|
61
|
+
done
|
62
|
+
|
63
|
+
[[ -n $debug ]] && set -x
|
64
|
+
|
65
|
+
fixUser "$@"
|
66
|
+
|
67
|
+
# use default value for data_dir if not specified
|
68
|
+
# relative path starts at ${solr_root}
|
69
|
+
if [[ -z ${data_dir} ]]
|
70
|
+
then
|
71
|
+
data_dir=${solr_root}/data
|
72
|
+
elif [[ "`echo ${data_dir}|cut -c1`" != "/" ]]
|
73
|
+
then
|
74
|
+
data_dir=${solr_root}/${data_dir}
|
75
|
+
fi
|
76
|
+
|
77
|
+
start=`date +"%s"`
|
78
|
+
|
79
|
+
logMessage started by $oldwhoami
|
80
|
+
logMessage command: $0 $@
|
81
|
+
|
82
|
+
snap_name=snapshot.`date +"%Y%m%d%H%M%S"`
|
83
|
+
name=${data_dir}/${snap_name}
|
84
|
+
temp=${data_dir}/temp-${snap_name}
|
85
|
+
|
86
|
+
if [[ -d ${name} ]]
|
87
|
+
then
|
88
|
+
logMessage snapshot directory ${name} already exists
|
89
|
+
logExit aborted 1
|
90
|
+
fi
|
91
|
+
|
92
|
+
if [[ -d ${temp} ]]
|
93
|
+
then
|
94
|
+
logMessage snapshoting of ${name} in progress
|
95
|
+
logExit aborted 1
|
96
|
+
fi
|
97
|
+
|
98
|
+
# clean up after INT/TERM
|
99
|
+
trap 'echo cleaning up, please wait ...;/bin/rm -rf ${name} ${temp};logExit aborted 13' INT TERM
|
100
|
+
|
101
|
+
logMessage taking snapshot ${name}
|
102
|
+
|
103
|
+
# take a snapshot using hard links into temporary location
|
104
|
+
# then move it into place atomically
|
105
|
+
cp -lr ${data_dir}/index ${temp}
|
106
|
+
mv ${temp} ${name}
|
107
|
+
|
108
|
+
logExit ended 0
|
109
|
+
|
@@ -0,0 +1,31 @@
|
|
1
|
+
<!--
|
2
|
+
Licensed to the Apache Software Foundation (ASF) under one or more
|
3
|
+
contributor license agreements. See the NOTICE file distributed with
|
4
|
+
this work for additional information regarding copyright ownership.
|
5
|
+
The ASF licenses this file to You under the Apache License, Version 2.0
|
6
|
+
(the "License"); you may not use this file except in compliance with
|
7
|
+
the License. You may obtain a copy of the License at
|
8
|
+
|
9
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
10
|
+
|
11
|
+
Unless required by applicable law or agreed to in writing, software
|
12
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
+
See the License for the specific language governing permissions and
|
15
|
+
limitations under the License.
|
16
|
+
-->
|
17
|
+
|
18
|
+
<!-- The content of this page will be statically included into the top
|
19
|
+
of the admin page. Uncomment this as an example to see there the content
|
20
|
+
will show up.
|
21
|
+
|
22
|
+
<hr>
|
23
|
+
<i>This line will appear before the first table</i>
|
24
|
+
<tr>
|
25
|
+
<td colspan="2">
|
26
|
+
This row will be appended to the end of the first table
|
27
|
+
</td>
|
28
|
+
</tr>
|
29
|
+
<hr>
|
30
|
+
|
31
|
+
-->
|
@@ -0,0 +1,21 @@
|
|
1
|
+
# The ASF licenses this file to You under the Apache License, Version 2.0
|
2
|
+
# (the "License"); you may not use this file except in compliance with
|
3
|
+
# the License. You may obtain a copy of the License at
|
4
|
+
#
|
5
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
6
|
+
#
|
7
|
+
# Unless required by applicable law or agreed to in writing, software
|
8
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
9
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
10
|
+
# See the License for the specific language governing permissions and
|
11
|
+
# limitations under the License.
|
12
|
+
|
13
|
+
#-----------------------------------------------------------------------
|
14
|
+
# Use a protected word file to protect against the stemmer reducing two
|
15
|
+
# unrelated words to the same base word.
|
16
|
+
|
17
|
+
# Some non-words that normally won't be encountered,
|
18
|
+
# just to test that they won't be stemmed.
|
19
|
+
dontstems
|
20
|
+
zwhacky
|
21
|
+
|