moneypools-thinking-sphinx 1.2.11 → 1.2.12
Sign up to get free protection for your applications and to get access to all the features.
- data/README.textile +4 -17
- data/VERSION.yml +1 -1
- data/features/a.rb +17 -0
- data/features/alternate_primary_key.feature +27 -0
- data/features/attribute_transformation.feature +22 -0
- data/features/attribute_updates.feature +33 -0
- data/features/datetime_deltas.feature +66 -0
- data/features/delayed_delta_indexing.feature +37 -0
- data/features/deleting_instances.feature +64 -0
- data/features/direct_attributes.feature +11 -0
- data/features/excerpts.feature +13 -0
- data/features/extensible_delta_indexing.feature +9 -0
- data/features/facets.feature +76 -0
- data/features/facets_across_model.feature +29 -0
- data/features/handling_edits.feature +92 -0
- data/features/retry_stale_indexes.feature +24 -0
- data/features/searching_across_models.feature +20 -0
- data/features/searching_by_model.feature +175 -0
- data/features/searching_with_find_arguments.feature +56 -0
- data/features/sphinx_detection.feature +25 -0
- data/features/sphinx_scopes.feature +35 -0
- data/features/step_definitions/alpha_steps.rb +3 -0
- data/features/step_definitions/beta_steps.rb +7 -0
- data/features/step_definitions/common_steps.rb +178 -0
- data/features/step_definitions/datetime_delta_steps.rb +15 -0
- data/features/step_definitions/delayed_delta_indexing_steps.rb +7 -0
- data/features/step_definitions/extensible_delta_indexing_steps.rb +7 -0
- data/features/step_definitions/facet_steps.rb +92 -0
- data/features/step_definitions/find_arguments_steps.rb +36 -0
- data/features/step_definitions/gamma_steps.rb +15 -0
- data/features/step_definitions/scope_steps.rb +11 -0
- data/features/step_definitions/search_steps.rb +89 -0
- data/features/step_definitions/sphinx_steps.rb +31 -0
- data/features/sti_searching.feature +14 -0
- data/features/support/db/active_record.rb +40 -0
- data/features/support/db/database.example.yml +3 -0
- data/features/support/db/fixtures/alphas.rb +10 -0
- data/features/support/db/fixtures/authors.rb +1 -0
- data/features/support/db/fixtures/betas.rb +10 -0
- data/features/support/db/fixtures/boxes.rb +9 -0
- data/features/support/db/fixtures/categories.rb +1 -0
- data/features/support/db/fixtures/cats.rb +3 -0
- data/features/support/db/fixtures/comments.rb +24 -0
- data/features/support/db/fixtures/delayed_betas.rb +10 -0
- data/features/support/db/fixtures/developers.rb +29 -0
- data/features/support/db/fixtures/dogs.rb +3 -0
- data/features/support/db/fixtures/extensible_betas.rb +10 -0
- data/features/support/db/fixtures/gammas.rb +10 -0
- data/features/support/db/fixtures/people.rb +1001 -0
- data/features/support/db/fixtures/posts.rb +6 -0
- data/features/support/db/fixtures/robots.rb +14 -0
- data/features/support/db/fixtures/tags.rb +27 -0
- data/features/support/db/fixtures/thetas.rb +10 -0
- data/features/support/db/migrations/create_alphas.rb +7 -0
- data/features/support/db/migrations/create_animals.rb +5 -0
- data/features/support/db/migrations/create_authors.rb +3 -0
- data/features/support/db/migrations/create_authors_posts.rb +6 -0
- data/features/support/db/migrations/create_betas.rb +5 -0
- data/features/support/db/migrations/create_boxes.rb +5 -0
- data/features/support/db/migrations/create_categories.rb +3 -0
- data/features/support/db/migrations/create_comments.rb +10 -0
- data/features/support/db/migrations/create_delayed_betas.rb +17 -0
- data/features/support/db/migrations/create_developers.rb +9 -0
- data/features/support/db/migrations/create_extensible_betas.rb +5 -0
- data/features/support/db/migrations/create_gammas.rb +3 -0
- data/features/support/db/migrations/create_people.rb +13 -0
- data/features/support/db/migrations/create_posts.rb +5 -0
- data/features/support/db/migrations/create_robots.rb +5 -0
- data/features/support/db/migrations/create_taggings.rb +5 -0
- data/features/support/db/migrations/create_tags.rb +4 -0
- data/features/support/db/migrations/create_thetas.rb +5 -0
- data/features/support/db/mysql.rb +3 -0
- data/features/support/db/postgresql.rb +3 -0
- data/features/support/env.rb +6 -0
- data/features/support/lib/generic_delta_handler.rb +8 -0
- data/features/support/models/alpha.rb +10 -0
- data/features/support/models/animal.rb +5 -0
- data/features/support/models/author.rb +3 -0
- data/features/support/models/beta.rb +8 -0
- data/features/support/models/box.rb +8 -0
- data/features/support/models/cat.rb +3 -0
- data/features/support/models/category.rb +4 -0
- data/features/support/models/comment.rb +10 -0
- data/features/support/models/delayed_beta.rb +7 -0
- data/features/support/models/developer.rb +16 -0
- data/features/support/models/dog.rb +3 -0
- data/features/support/models/extensible_beta.rb +9 -0
- data/features/support/models/gamma.rb +5 -0
- data/features/support/models/person.rb +23 -0
- data/features/support/models/post.rb +20 -0
- data/features/support/models/robot.rb +8 -0
- data/features/support/models/tag.rb +3 -0
- data/features/support/models/tagging.rb +4 -0
- data/features/support/models/theta.rb +7 -0
- data/features/support/post_database.rb +43 -0
- data/features/support/z.rb +19 -0
- data/lib/thinking_sphinx.rb +1 -0
- data/lib/thinking_sphinx/active_record.rb +1 -2
- data/lib/thinking_sphinx/attribute.rb +3 -2
- data/lib/thinking_sphinx/configuration.rb +2 -2
- data/lib/thinking_sphinx/deploy/capistrano.rb +1 -1
- data/lib/thinking_sphinx/excerpter.rb +1 -1
- data/lib/thinking_sphinx/search.rb +19 -0
- data/lib/thinking_sphinx/source.rb +1 -1
- data/spec/lib/thinking_sphinx/active_record_spec.rb +0 -11
- data/spec/lib/thinking_sphinx/attribute_spec.rb +14 -7
- data/spec/lib/thinking_sphinx/deltas/job_spec.rb +32 -0
- data/spec/lib/thinking_sphinx/excerpter_spec.rb +8 -0
- data/spec/lib/thinking_sphinx/search_spec.rb +52 -17
- data/tasks/distribution.rb +10 -6
- data/vendor/riddle/lib/riddle.rb +1 -1
- data/vendor/riddle/lib/riddle/client.rb +16 -3
- data/vendor/riddle/lib/riddle/controller.rb +9 -10
- metadata +98 -3
@@ -405,7 +405,7 @@ module Riddle
|
|
405
405
|
"Connection to #{@server} on #{@port} timed out after #{@timeout} seconds"
|
406
406
|
end
|
407
407
|
end
|
408
|
-
|
408
|
+
|
409
409
|
begin
|
410
410
|
yield socket
|
411
411
|
ensure
|
@@ -414,8 +414,8 @@ module Riddle
|
|
414
414
|
end
|
415
415
|
|
416
416
|
def initialise_connection
|
417
|
-
socket =
|
418
|
-
|
417
|
+
socket = initialise_socket
|
418
|
+
|
419
419
|
# Checking version
|
420
420
|
version = socket.recv(4).unpack('N*').first
|
421
421
|
if version < 1
|
@@ -429,6 +429,19 @@ module Riddle
|
|
429
429
|
socket
|
430
430
|
end
|
431
431
|
|
432
|
+
def initialise_socket
|
433
|
+
tries = 0
|
434
|
+
begin
|
435
|
+
socket = TCPSocket.new @server, @port
|
436
|
+
rescue Errno::ECONNREFUSED => e
|
437
|
+
retry if (tries += 1) < 5
|
438
|
+
raise Riddle::ConnectionError,
|
439
|
+
"Connection to #{@server} on #{@port} failed. #{e.message}"
|
440
|
+
end
|
441
|
+
|
442
|
+
socket
|
443
|
+
end
|
444
|
+
|
432
445
|
# Send a collection of messages, for a command type (eg, search, excerpts,
|
433
446
|
# update), to the Sphinx daemon.
|
434
447
|
def request(command, messages)
|
@@ -4,38 +4,38 @@ module Riddle
|
|
4
4
|
@configuration = configuration
|
5
5
|
@path = path
|
6
6
|
end
|
7
|
-
|
7
|
+
|
8
8
|
def index
|
9
9
|
cmd = "indexer --config #{@path} --all"
|
10
10
|
cmd << " --rotate" if running?
|
11
11
|
`#{cmd}`
|
12
12
|
end
|
13
|
-
|
13
|
+
|
14
14
|
def start
|
15
15
|
return if running?
|
16
|
-
|
16
|
+
|
17
17
|
cmd = "searchd --pidfile --config #{@path}"
|
18
|
-
|
18
|
+
|
19
19
|
if RUBY_PLATFORM =~ /mswin/
|
20
20
|
system("start /B #{cmd} 1> NUL 2>&1")
|
21
21
|
else
|
22
22
|
`#{cmd}`
|
23
23
|
end
|
24
|
-
|
24
|
+
|
25
25
|
sleep(1)
|
26
|
-
|
26
|
+
|
27
27
|
unless running?
|
28
28
|
puts "Failed to start searchd daemon. Check #{@configuration.searchd.log}."
|
29
29
|
end
|
30
30
|
end
|
31
|
-
|
31
|
+
|
32
32
|
def stop
|
33
33
|
return unless running?
|
34
34
|
Process.kill('SIGTERM', pid.to_i)
|
35
35
|
rescue Errno::EINVAL
|
36
36
|
Process.kill('SIGKILL', pid.to_i)
|
37
37
|
end
|
38
|
-
|
38
|
+
|
39
39
|
def pid
|
40
40
|
if File.exists?(@configuration.searchd.pid_file)
|
41
41
|
File.read(@configuration.searchd.pid_file)[/\d+/]
|
@@ -43,12 +43,11 @@ module Riddle
|
|
43
43
|
nil
|
44
44
|
end
|
45
45
|
end
|
46
|
-
|
46
|
+
|
47
47
|
def running?
|
48
48
|
!!pid && !!Process.kill(0, pid.to_i)
|
49
49
|
rescue
|
50
50
|
false
|
51
51
|
end
|
52
|
-
|
53
52
|
end
|
54
53
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: moneypools-thinking-sphinx
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.2.
|
4
|
+
version: 1.2.12
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Pat Allan
|
@@ -22,7 +22,7 @@ dependencies:
|
|
22
22
|
- !ruby/object:Gem::Version
|
23
23
|
version: 1.15.6
|
24
24
|
version:
|
25
|
-
description:
|
25
|
+
description: A concise and easy-to-use Ruby library that connects ActiveRecord to the Sphinx search daemon, managing configuration, indexing and searching.
|
26
26
|
email: pat@freelancing-gods.com
|
27
27
|
executables: []
|
28
28
|
|
@@ -143,8 +143,102 @@ rubyforge_project:
|
|
143
143
|
rubygems_version: 1.3.5
|
144
144
|
signing_key:
|
145
145
|
specification_version: 3
|
146
|
-
summary:
|
146
|
+
summary: ActiveRecord/Rails Sphinx library
|
147
147
|
test_files:
|
148
|
+
- features/a.rb
|
149
|
+
- features/alternate_primary_key.feature
|
150
|
+
- features/attribute_transformation.feature
|
151
|
+
- features/attribute_updates.feature
|
152
|
+
- features/datetime_deltas.feature
|
153
|
+
- features/delayed_delta_indexing.feature
|
154
|
+
- features/deleting_instances.feature
|
155
|
+
- features/direct_attributes.feature
|
156
|
+
- features/excerpts.feature
|
157
|
+
- features/extensible_delta_indexing.feature
|
158
|
+
- features/facets.feature
|
159
|
+
- features/facets_across_model.feature
|
160
|
+
- features/handling_edits.feature
|
161
|
+
- features/retry_stale_indexes.feature
|
162
|
+
- features/searching_across_models.feature
|
163
|
+
- features/searching_by_model.feature
|
164
|
+
- features/searching_with_find_arguments.feature
|
165
|
+
- features/sphinx_detection.feature
|
166
|
+
- features/sphinx_scopes.feature
|
167
|
+
- features/step_definitions/alpha_steps.rb
|
168
|
+
- features/step_definitions/beta_steps.rb
|
169
|
+
- features/step_definitions/common_steps.rb
|
170
|
+
- features/step_definitions/datetime_delta_steps.rb
|
171
|
+
- features/step_definitions/delayed_delta_indexing_steps.rb
|
172
|
+
- features/step_definitions/extensible_delta_indexing_steps.rb
|
173
|
+
- features/step_definitions/facet_steps.rb
|
174
|
+
- features/step_definitions/find_arguments_steps.rb
|
175
|
+
- features/step_definitions/gamma_steps.rb
|
176
|
+
- features/step_definitions/scope_steps.rb
|
177
|
+
- features/step_definitions/search_steps.rb
|
178
|
+
- features/step_definitions/sphinx_steps.rb
|
179
|
+
- features/sti_searching.feature
|
180
|
+
- features/support/db/active_record.rb
|
181
|
+
- features/support/db/database.example.yml
|
182
|
+
- features/support/db/fixtures/alphas.rb
|
183
|
+
- features/support/db/fixtures/authors.rb
|
184
|
+
- features/support/db/fixtures/betas.rb
|
185
|
+
- features/support/db/fixtures/boxes.rb
|
186
|
+
- features/support/db/fixtures/categories.rb
|
187
|
+
- features/support/db/fixtures/cats.rb
|
188
|
+
- features/support/db/fixtures/comments.rb
|
189
|
+
- features/support/db/fixtures/delayed_betas.rb
|
190
|
+
- features/support/db/fixtures/developers.rb
|
191
|
+
- features/support/db/fixtures/dogs.rb
|
192
|
+
- features/support/db/fixtures/extensible_betas.rb
|
193
|
+
- features/support/db/fixtures/gammas.rb
|
194
|
+
- features/support/db/fixtures/people.rb
|
195
|
+
- features/support/db/fixtures/posts.rb
|
196
|
+
- features/support/db/fixtures/robots.rb
|
197
|
+
- features/support/db/fixtures/tags.rb
|
198
|
+
- features/support/db/fixtures/thetas.rb
|
199
|
+
- features/support/db/migrations/create_alphas.rb
|
200
|
+
- features/support/db/migrations/create_animals.rb
|
201
|
+
- features/support/db/migrations/create_authors.rb
|
202
|
+
- features/support/db/migrations/create_authors_posts.rb
|
203
|
+
- features/support/db/migrations/create_betas.rb
|
204
|
+
- features/support/db/migrations/create_boxes.rb
|
205
|
+
- features/support/db/migrations/create_categories.rb
|
206
|
+
- features/support/db/migrations/create_comments.rb
|
207
|
+
- features/support/db/migrations/create_delayed_betas.rb
|
208
|
+
- features/support/db/migrations/create_developers.rb
|
209
|
+
- features/support/db/migrations/create_extensible_betas.rb
|
210
|
+
- features/support/db/migrations/create_gammas.rb
|
211
|
+
- features/support/db/migrations/create_people.rb
|
212
|
+
- features/support/db/migrations/create_posts.rb
|
213
|
+
- features/support/db/migrations/create_robots.rb
|
214
|
+
- features/support/db/migrations/create_taggings.rb
|
215
|
+
- features/support/db/migrations/create_tags.rb
|
216
|
+
- features/support/db/migrations/create_thetas.rb
|
217
|
+
- features/support/db/mysql.rb
|
218
|
+
- features/support/db/postgresql.rb
|
219
|
+
- features/support/env.rb
|
220
|
+
- features/support/lib/generic_delta_handler.rb
|
221
|
+
- features/support/models/alpha.rb
|
222
|
+
- features/support/models/animal.rb
|
223
|
+
- features/support/models/author.rb
|
224
|
+
- features/support/models/beta.rb
|
225
|
+
- features/support/models/box.rb
|
226
|
+
- features/support/models/cat.rb
|
227
|
+
- features/support/models/category.rb
|
228
|
+
- features/support/models/comment.rb
|
229
|
+
- features/support/models/delayed_beta.rb
|
230
|
+
- features/support/models/developer.rb
|
231
|
+
- features/support/models/dog.rb
|
232
|
+
- features/support/models/extensible_beta.rb
|
233
|
+
- features/support/models/gamma.rb
|
234
|
+
- features/support/models/person.rb
|
235
|
+
- features/support/models/post.rb
|
236
|
+
- features/support/models/robot.rb
|
237
|
+
- features/support/models/tag.rb
|
238
|
+
- features/support/models/tagging.rb
|
239
|
+
- features/support/models/theta.rb
|
240
|
+
- features/support/post_database.rb
|
241
|
+
- features/support/z.rb
|
148
242
|
- spec/lib/thinking_sphinx/active_record/delta_spec.rb
|
149
243
|
- spec/lib/thinking_sphinx/active_record/has_many_association_spec.rb
|
150
244
|
- spec/lib/thinking_sphinx/active_record/scopes_spec.rb
|
@@ -154,6 +248,7 @@ test_files:
|
|
154
248
|
- spec/lib/thinking_sphinx/configuration_spec.rb
|
155
249
|
- spec/lib/thinking_sphinx/core/array_spec.rb
|
156
250
|
- spec/lib/thinking_sphinx/core/string_spec.rb
|
251
|
+
- spec/lib/thinking_sphinx/deltas/job_spec.rb
|
157
252
|
- spec/lib/thinking_sphinx/excerpter_spec.rb
|
158
253
|
- spec/lib/thinking_sphinx/facet_search_spec.rb
|
159
254
|
- spec/lib/thinking_sphinx/facet_spec.rb
|