outoftime-sunspot 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +9 -6
- data/README.rdoc +45 -13
- data/Rakefile +5 -21
- data/VERSION.yml +4 -0
- data/bin/sunspot-solr +39 -0
- data/lib/sunspot/builder.rb +78 -0
- data/lib/sunspot/dsl/fields.rb +39 -0
- data/lib/sunspot/dsl/query.rb +32 -0
- data/lib/sunspot/dsl/scope.rb +35 -0
- data/lib/sunspot/dsl.rb +3 -0
- data/lib/sunspot/query.rb +9 -20
- data/lib/sunspot/search.rb +8 -25
- data/lib/sunspot.rb +2 -3
- data/solr/etc/jetty.xml +10 -4
- data/solr/solr/conf/{admin-extra.html → elevate.xml} +18 -13
- data/solr/solr/conf/solrconfig.xml +369 -67
- data/solr/webapps/solr.war +0 -0
- data/spec/api/build_search_spec.rb +195 -0
- data/spec/api/indexer_spec.rb +112 -0
- data/spec/api/search_retrieval_spec.rb +59 -0
- data/spec/api/session_spec.rb +44 -0
- data/spec/api/spec_helper.rb +1 -0
- data/spec/api/standard_search_builder_spec.rb +76 -0
- data/{test → spec}/custom_expectation.rb +0 -0
- data/{test/integration/test_field_types.rb → spec/integration/field_types_spec.rb} +9 -9
- data/{test/integration/test_keyword_search.rb → spec/integration/keyword_search_spec.rb} +5 -5
- data/spec/integration/spec_helper.rb +1 -0
- data/{test → spec}/integration/test_pagination.rb +5 -5
- data/{test → spec}/mocks/base_class.rb +0 -0
- data/{test → spec}/mocks/comment.rb +0 -0
- data/{test → spec}/mocks/mock_adapter.rb +0 -0
- data/{test → spec}/mocks/post.rb +0 -0
- data/{test/test_helper.rb → spec/spec_helper.rb} +6 -12
- data/tasks/gemspec.rake +18 -0
- data/tasks/rcov.rake +27 -5
- data/tasks/spec.rake +21 -0
- metadata +90 -125
- data/Manifest.txt +0 -104
- data/PostInstall.txt +0 -7
- data/config/hoe.rb +0 -74
- data/config/requirements.rb +0 -15
- data/lib/sunspot/conditions.rb +0 -50
- data/lib/sunspot/conditions_builder.rb +0 -37
- data/lib/sunspot/field_builder.rb +0 -37
- data/lib/sunspot/query_builder.rb +0 -30
- data/lib/sunspot/scope_builder.rb +0 -33
- data/lib/sunspot/version.rb +0 -10
- data/setup.rb +0 -1585
- data/solr/README.txt +0 -36
- data/solr/exampledocs/books.csv +0 -11
- data/solr/exampledocs/hd.xml +0 -46
- data/solr/exampledocs/ipod_other.xml +0 -50
- data/solr/exampledocs/ipod_video.xml +0 -35
- data/solr/exampledocs/mem.xml +0 -58
- data/solr/exampledocs/monitor.xml +0 -31
- data/solr/exampledocs/monitor2.xml +0 -30
- data/solr/exampledocs/mp500.xml +0 -39
- data/solr/exampledocs/post.jar +0 -0
- data/solr/exampledocs/post.sh +0 -28
- data/solr/exampledocs/sd500.xml +0 -33
- data/solr/exampledocs/solr.xml +0 -38
- data/solr/exampledocs/spellchecker.xml +0 -58
- data/solr/exampledocs/utf8-example.xml +0 -42
- data/solr/exampledocs/vidcard.xml +0 -52
- data/solr/solr/README.txt +0 -52
- data/solr/solr/bin/abc +0 -176
- data/solr/solr/bin/abo +0 -176
- data/solr/solr/bin/backup +0 -108
- data/solr/solr/bin/backupcleaner +0 -142
- data/solr/solr/bin/commit +0 -128
- data/solr/solr/bin/optimize +0 -129
- data/solr/solr/bin/readercycle +0 -129
- data/solr/solr/bin/rsyncd-disable +0 -77
- data/solr/solr/bin/rsyncd-enable +0 -76
- data/solr/solr/bin/rsyncd-start +0 -145
- data/solr/solr/bin/rsyncd-stop +0 -105
- data/solr/solr/bin/scripts-util +0 -83
- data/solr/solr/bin/snapcleaner +0 -148
- data/solr/solr/bin/snapinstaller +0 -168
- data/solr/solr/bin/snappuller +0 -248
- data/solr/solr/bin/snappuller-disable +0 -77
- data/solr/solr/bin/snappuller-enable +0 -77
- data/solr/solr/bin/snapshooter +0 -109
- data/solr/solr/conf/scripts.conf +0 -24
- data/tasks/deployment.rake +0 -34
- data/tasks/environment.rake +0 -7
- data/tasks/solr.rake +0 -12
- data/tasks/website.rake +0 -17
- data/test/api/test_build_search.rb +0 -216
- data/test/api/test_helper.rb +0 -4
- data/test/api/test_indexer.rb +0 -110
- data/test/api/test_retrieve_search.rb +0 -114
- data/test/api/test_session.rb +0 -46
- data/test/integration/test_helper.rb +0 -1
data/solr/solr/bin/snappuller
DELETED
@@ -1,248 +0,0 @@
|
|
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
|
@@ -1,77 +0,0 @@
|
|
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
|
@@ -1,77 +0,0 @@
|
|
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
|
data/solr/solr/bin/snapshooter
DELETED
@@ -1,109 +0,0 @@
|
|
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
|
-
|
data/solr/solr/conf/scripts.conf
DELETED
@@ -1,24 +0,0 @@
|
|
1
|
-
# Licensed to the Apache Software Foundation (ASF) under one or more
|
2
|
-
# contributor license agreements. See the NOTICE file distributed with
|
3
|
-
# this work for additional information regarding copyright ownership.
|
4
|
-
# The ASF licenses this file to You under the Apache License, Version 2.0
|
5
|
-
# (the "License"); you may not use this file except in compliance with
|
6
|
-
# the License. You may obtain a copy of the License at
|
7
|
-
#
|
8
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
9
|
-
#
|
10
|
-
# Unless required by applicable law or agreed to in writing, software
|
11
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
12
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13
|
-
# See the License for the specific language governing permissions and
|
14
|
-
# limitations under the License.
|
15
|
-
|
16
|
-
user=
|
17
|
-
solr_hostname=localhost
|
18
|
-
solr_port=8983
|
19
|
-
rsyncd_port=18983
|
20
|
-
data_dir=
|
21
|
-
webapp_name=solr
|
22
|
-
master_host=
|
23
|
-
master_data_dir=
|
24
|
-
master_status_dir=
|
data/tasks/deployment.rake
DELETED
@@ -1,34 +0,0 @@
|
|
1
|
-
desc 'Release the website and new gem version'
|
2
|
-
task :deploy => [:check_version, :website, :release] do
|
3
|
-
puts "Remember to create SVN tag:"
|
4
|
-
puts "svn copy svn+ssh://#{rubyforge_username}@rubyforge.org/var/svn/#{PATH}/trunk " +
|
5
|
-
"svn+ssh://#{rubyforge_username}@rubyforge.org/var/svn/#{PATH}/tags/REL-#{VERS} "
|
6
|
-
puts "Suggested comment:"
|
7
|
-
puts "Tagging release #{CHANGES}"
|
8
|
-
end
|
9
|
-
|
10
|
-
desc 'Runs tasks website_generate and install_gem as a local deployment of the gem'
|
11
|
-
task :local_deploy => [:website_generate, :install_gem]
|
12
|
-
|
13
|
-
task :check_version do
|
14
|
-
unless ENV['VERSION']
|
15
|
-
puts 'Must pass a VERSION=x.y.z release version'
|
16
|
-
exit
|
17
|
-
end
|
18
|
-
unless ENV['VERSION'] == VERS
|
19
|
-
puts "Please update your version.rb to match the release version, currently #{VERS}"
|
20
|
-
exit
|
21
|
-
end
|
22
|
-
end
|
23
|
-
|
24
|
-
desc 'Install the package as a gem, without generating documentation(ri/rdoc)'
|
25
|
-
task :install_gem_no_doc => [:clean, :package] do
|
26
|
-
sh "#{'sudo ' unless Hoe::WINDOZE }gem install pkg/*.gem --no-rdoc --no-ri"
|
27
|
-
end
|
28
|
-
|
29
|
-
namespace :manifest do
|
30
|
-
desc 'Recreate Manifest.txt to include ALL files'
|
31
|
-
task :refresh do
|
32
|
-
`rake check_manifest | patch -p0 > Manifest.txt`
|
33
|
-
end
|
34
|
-
end
|
data/tasks/environment.rake
DELETED
data/tasks/solr.rake
DELETED
@@ -1,12 +0,0 @@
|
|
1
|
-
namespace :solr do
|
2
|
-
namespace :test do
|
3
|
-
desc 'Start Solr server'
|
4
|
-
task :start do
|
5
|
-
FileUtils.cd File.join(File.dirname(__FILE__), '..', 'solr') do
|
6
|
-
Kernel.fork do
|
7
|
-
Kernel.exec("java -jar start.jar 2> #{File.join('..', 'log', 'test_solr.log')}")
|
8
|
-
end
|
9
|
-
end
|
10
|
-
end
|
11
|
-
end
|
12
|
-
end
|
data/tasks/website.rake
DELETED
@@ -1,17 +0,0 @@
|
|
1
|
-
desc 'Generate website files'
|
2
|
-
task :website_generate => :ruby_env do
|
3
|
-
(Dir['website/**/*.txt'] - Dir['website/version*.txt']).each do |txt|
|
4
|
-
sh %{ #{RUBY_APP} script/txt2html #{txt} > #{txt.gsub(/txt$/,'html')} }
|
5
|
-
end
|
6
|
-
end
|
7
|
-
|
8
|
-
desc 'Upload website files to rubyforge'
|
9
|
-
task :website_upload do
|
10
|
-
host = "#{rubyforge_username}@rubyforge.org"
|
11
|
-
remote_dir = "/var/www/gforge-projects/#{PATH}/"
|
12
|
-
local_dir = 'website'
|
13
|
-
sh %{rsync -aCv #{local_dir}/ #{host}:#{remote_dir}}
|
14
|
-
end
|
15
|
-
|
16
|
-
desc 'Generate and upload website files'
|
17
|
-
task :website => [:website_generate, :website_upload, :publish_docs]
|