riddle 1.5.0 → 1.5.1
Sign up to get free protection for your applications and to get access to all the features.
- data/HISTORY +4 -0
- data/README.textile +28 -38
- data/lib/riddle/2.1.0.rb +16 -0
- data/lib/riddle/auto_version.rb +2 -0
- data/lib/riddle/client.rb +53 -49
- data/lib/riddle/version.rb +1 -1
- data/spec/fixtures/data/2.1.0/anchor.bin +0 -0
- data/spec/fixtures/data/2.1.0/any.bin +0 -0
- data/spec/fixtures/data/2.1.0/boolean.bin +0 -0
- data/spec/fixtures/data/2.1.0/comment.bin +0 -0
- data/spec/fixtures/data/2.1.0/distinct.bin +0 -0
- data/spec/fixtures/data/2.1.0/field_weights.bin +0 -0
- data/spec/fixtures/data/2.1.0/filter.bin +0 -0
- data/spec/fixtures/data/2.1.0/filter_array.bin +0 -0
- data/spec/fixtures/data/2.1.0/filter_array_exclude.bin +0 -0
- data/spec/fixtures/data/2.1.0/filter_boolean.bin +0 -0
- data/spec/fixtures/data/2.1.0/filter_floats.bin +0 -0
- data/spec/fixtures/data/2.1.0/filter_floats_exclude.bin +0 -0
- data/spec/fixtures/data/2.1.0/filter_range.bin +0 -0
- data/spec/fixtures/data/2.1.0/filter_range_exclude.bin +0 -0
- data/spec/fixtures/data/2.1.0/group.bin +0 -0
- data/spec/fixtures/data/2.1.0/index.bin +0 -0
- data/spec/fixtures/data/2.1.0/index_weights.bin +0 -0
- data/spec/fixtures/data/2.1.0/keywords_with_hits.bin +0 -0
- data/spec/fixtures/data/2.1.0/keywords_without_hits.bin +0 -0
- data/spec/fixtures/data/2.1.0/overrides.bin +0 -0
- data/spec/fixtures/data/2.1.0/phrase.bin +0 -0
- data/spec/fixtures/data/2.1.0/rank_mode.bin +0 -0
- data/spec/fixtures/data/2.1.0/select.bin +0 -0
- data/spec/fixtures/data/2.1.0/simple.bin +0 -0
- data/spec/fixtures/data/2.1.0/sort.bin +0 -0
- data/spec/fixtures/data/2.1.0/update_simple.bin +0 -0
- data/spec/fixtures/data/2.1.0/weights.bin +0 -0
- data/spec/fixtures/data_generator.2.1.0.php +5 -0
- data/spec/fixtures/sphinxapi.2.1.0.php +1752 -0
- data/spec/functional/excerpt_spec.rb +12 -12
- data/spec/riddle/auto_version_spec.rb +7 -0
- data/spec/support/binary_fixtures.rb +3 -3
- metadata +70 -10
@@ -4,7 +4,7 @@ describe "Sphinx Excepts", :live => true do
|
|
4
4
|
before :each do
|
5
5
|
@client = Riddle::Client.new("localhost", 9313)
|
6
6
|
end
|
7
|
-
|
7
|
+
|
8
8
|
it "should highlight a single word multiple times in a document" do
|
9
9
|
@client.excerpts(
|
10
10
|
:index => "people",
|
@@ -14,7 +14,7 @@ describe "Sphinx Excepts", :live => true do
|
|
14
14
|
'<span class="match">Mary</span>, <span class="match">Mary</span>, quite contrary.'
|
15
15
|
]
|
16
16
|
end
|
17
|
-
|
17
|
+
|
18
18
|
it "should use specified word markers" do
|
19
19
|
@client.excerpts(
|
20
20
|
:index => "people",
|
@@ -26,7 +26,7 @@ describe "Sphinx Excepts", :live => true do
|
|
26
26
|
"<em>Mary</em>, <em>Mary</em>, quite contrary."
|
27
27
|
]
|
28
28
|
end
|
29
|
-
|
29
|
+
|
30
30
|
it "should separate matches that are far apart by an ellipsis by default" do
|
31
31
|
excerpts = @client.excerpts(
|
32
32
|
:index => "people",
|
@@ -34,7 +34,7 @@ describe "Sphinx Excepts", :live => true do
|
|
34
34
|
:docs => [
|
35
35
|
<<-SENTENCE
|
36
36
|
This is a really long sentence written by Pat. It has to be over 256
|
37
|
-
characters long, between keywords. But what is the keyword? Well, I
|
37
|
+
characters long, between keywords. But what is the keyword? Well, I
|
38
38
|
can't tell you just yet... wait patiently until we've hit the 256 mark.
|
39
39
|
It'll take a bit longer than you think. We're probably just hitting the
|
40
40
|
200 mark at this point. But I think we've now arrived - so I can tell
|
@@ -46,8 +46,8 @@ not. It's just my name: Pat.
|
|
46
46
|
:before_match => "<em>",
|
47
47
|
:after_match => "</em>"
|
48
48
|
)
|
49
|
-
|
50
|
-
|
49
|
+
|
50
|
+
|
51
51
|
case Riddle.loaded_version
|
52
52
|
when '0.9.9'
|
53
53
|
excerpts.should == [
|
@@ -60,7 +60,7 @@ not. It's just my name: <em>Pat</em>.
|
|
60
60
|
]
|
61
61
|
when '1.10'
|
62
62
|
excerpts.should == [" … really long sentence written by <em>Pat</em>. It has to be over … . This keyword, however, is\nnot. It's just my name: <em>Pat</em> … "]
|
63
|
-
when '2.0.1'
|
63
|
+
when '2.0.1', '2.1.0'
|
64
64
|
excerpts.should == [" … really long sentence written by <em>Pat</em>. It has to be over … . It's just my name: <em>Pat</em>.\n"]
|
65
65
|
else
|
66
66
|
excerpts.should == [
|
@@ -73,7 +73,7 @@ not. It's just my name: <em>Pat</em>.
|
|
73
73
|
]
|
74
74
|
end
|
75
75
|
end
|
76
|
-
|
76
|
+
|
77
77
|
it "should use the provided separator" do
|
78
78
|
excerpts = @client.excerpts(
|
79
79
|
:index => "people",
|
@@ -81,7 +81,7 @@ not. It's just my name: <em>Pat</em>.
|
|
81
81
|
:docs => [
|
82
82
|
<<-SENTENCE
|
83
83
|
This is a really long sentence written by Pat. It has to be over 256
|
84
|
-
characters long, between keywords. But what is the keyword? Well, I
|
84
|
+
characters long, between keywords. But what is the keyword? Well, I
|
85
85
|
can't tell you just yet... wait patiently until we've hit the 256 mark.
|
86
86
|
It'll take a bit longer than you think. We're probably just hitting the
|
87
87
|
200 mark at this point. But I think we've now arrived - so I can tell
|
@@ -94,7 +94,7 @@ not. It's just my name: Pat.
|
|
94
94
|
:after_match => "</em>",
|
95
95
|
:chunk_separator => " --- "
|
96
96
|
)
|
97
|
-
|
97
|
+
|
98
98
|
case Riddle.loaded_version
|
99
99
|
when '0.9.9'
|
100
100
|
excerpts.should == [
|
@@ -107,7 +107,7 @@ not. It's just my name: <em>Pat</em>.
|
|
107
107
|
]
|
108
108
|
when '1.10'
|
109
109
|
excerpts.should == [" --- really long sentence written by <em>Pat</em>. It has to be over --- . This keyword, however, is\nnot. It's just my name: <em>Pat</em> --- "]
|
110
|
-
when '2.0.1'
|
110
|
+
when '2.0.1', '2.1.0'
|
111
111
|
excerpts.should == [" --- really long sentence written by <em>Pat</em>. It has to be over --- . It's just my name: <em>Pat</em>.\n"]
|
112
112
|
else
|
113
113
|
excerpts.should == [
|
@@ -120,7 +120,7 @@ not. It's just my name: <em>Pat</em>.
|
|
120
120
|
]
|
121
121
|
end
|
122
122
|
end
|
123
|
-
|
123
|
+
|
124
124
|
it "should return multiple results for multiple documents" do
|
125
125
|
@client.excerpts(
|
126
126
|
:index => "people",
|
@@ -49,5 +49,12 @@ describe Riddle::AutoVersion do
|
|
49
49
|
@controller.stub!(:sphinx_version => '2.0.1-beta')
|
50
50
|
Riddle::AutoVersion.configure
|
51
51
|
end
|
52
|
+
|
53
|
+
it "should require 2.1.0 if that is the known version" do
|
54
|
+
Riddle::AutoVersion.should_receive(:require).with('riddle/2.1.0')
|
55
|
+
|
56
|
+
@controller.stub!(:sphinx_version => '2.1.0-dev')
|
57
|
+
Riddle::AutoVersion.configure
|
58
|
+
end
|
52
59
|
end
|
53
60
|
end
|
@@ -1,14 +1,14 @@
|
|
1
1
|
module BinaryFixtures
|
2
2
|
def self.build_fixtures(version = nil)
|
3
3
|
return if ENV['TRAVIS']
|
4
|
-
|
5
|
-
version ||= %w(0.9.9 1.10 2.0.1)
|
4
|
+
|
5
|
+
version ||= %w(0.9.9 1.10 2.0.1 2.1.0)
|
6
6
|
Array(version).each do |version|
|
7
7
|
FileUtils.mkdir_p "spec/fixtures/data/#{version}"
|
8
8
|
`php -f spec/fixtures/data_generator.#{version}.php`
|
9
9
|
end
|
10
10
|
end
|
11
|
-
|
11
|
+
|
12
12
|
def query_contents(key)
|
13
13
|
path = "spec/fixtures/data/#{Riddle.loaded_version}/#{key}.bin"
|
14
14
|
contents = open(path) { |f| f.read }
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: riddle
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.5.
|
4
|
+
version: 1.5.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2012-01-02 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rake
|
16
|
-
requirement: &
|
16
|
+
requirement: &70316764766880 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: 0.9.2
|
22
22
|
type: :development
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *70316764766880
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: rspec
|
27
|
-
requirement: &
|
27
|
+
requirement: &70316764765360 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ! '>='
|
@@ -32,10 +32,10 @@ dependencies:
|
|
32
32
|
version: 2.5.0
|
33
33
|
type: :development
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *70316764765360
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: yard
|
38
|
-
requirement: &
|
38
|
+
requirement: &70316764763300 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ! '>='
|
@@ -43,7 +43,7 @@ dependencies:
|
|
43
43
|
version: 0.7.2
|
44
44
|
type: :development
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *70316764763300
|
47
47
|
description: A Ruby API and configuration helper for the Sphinx search service.
|
48
48
|
email:
|
49
49
|
- pat@freelancing-gods.com
|
@@ -68,6 +68,7 @@ files:
|
|
68
68
|
- lib/riddle/1.10/client.rb
|
69
69
|
- lib/riddle/2.0.1.rb
|
70
70
|
- lib/riddle/2.0.1/client.rb
|
71
|
+
- lib/riddle/2.1.0.rb
|
71
72
|
- lib/riddle/auto_version.rb
|
72
73
|
- lib/riddle/client.rb
|
73
74
|
- lib/riddle/client/filter.rb
|
@@ -173,16 +174,45 @@ files:
|
|
173
174
|
- spec/fixtures/data/2.0.1/sort.bin
|
174
175
|
- spec/fixtures/data/2.0.1/update_simple.bin
|
175
176
|
- spec/fixtures/data/2.0.1/weights.bin
|
177
|
+
- spec/fixtures/data/2.1.0/anchor.bin
|
178
|
+
- spec/fixtures/data/2.1.0/any.bin
|
179
|
+
- spec/fixtures/data/2.1.0/boolean.bin
|
180
|
+
- spec/fixtures/data/2.1.0/comment.bin
|
181
|
+
- spec/fixtures/data/2.1.0/distinct.bin
|
182
|
+
- spec/fixtures/data/2.1.0/field_weights.bin
|
183
|
+
- spec/fixtures/data/2.1.0/filter.bin
|
184
|
+
- spec/fixtures/data/2.1.0/filter_array.bin
|
185
|
+
- spec/fixtures/data/2.1.0/filter_array_exclude.bin
|
186
|
+
- spec/fixtures/data/2.1.0/filter_boolean.bin
|
187
|
+
- spec/fixtures/data/2.1.0/filter_floats.bin
|
188
|
+
- spec/fixtures/data/2.1.0/filter_floats_exclude.bin
|
189
|
+
- spec/fixtures/data/2.1.0/filter_range.bin
|
190
|
+
- spec/fixtures/data/2.1.0/filter_range_exclude.bin
|
191
|
+
- spec/fixtures/data/2.1.0/group.bin
|
192
|
+
- spec/fixtures/data/2.1.0/index.bin
|
193
|
+
- spec/fixtures/data/2.1.0/index_weights.bin
|
194
|
+
- spec/fixtures/data/2.1.0/keywords_with_hits.bin
|
195
|
+
- spec/fixtures/data/2.1.0/keywords_without_hits.bin
|
196
|
+
- spec/fixtures/data/2.1.0/overrides.bin
|
197
|
+
- spec/fixtures/data/2.1.0/phrase.bin
|
198
|
+
- spec/fixtures/data/2.1.0/rank_mode.bin
|
199
|
+
- spec/fixtures/data/2.1.0/select.bin
|
200
|
+
- spec/fixtures/data/2.1.0/simple.bin
|
201
|
+
- spec/fixtures/data/2.1.0/sort.bin
|
202
|
+
- spec/fixtures/data/2.1.0/update_simple.bin
|
203
|
+
- spec/fixtures/data/2.1.0/weights.bin
|
176
204
|
- spec/fixtures/data_generator.0.9.8.php
|
177
205
|
- spec/fixtures/data_generator.0.9.9.php
|
178
206
|
- spec/fixtures/data_generator.1.10.php
|
179
207
|
- spec/fixtures/data_generator.2.0.1.php
|
208
|
+
- spec/fixtures/data_generator.2.1.0.php
|
180
209
|
- spec/fixtures/data_generator.php
|
181
210
|
- spec/fixtures/sphinx/configuration.erb
|
182
211
|
- spec/fixtures/sphinxapi.0.9.8.php
|
183
212
|
- spec/fixtures/sphinxapi.0.9.9.php
|
184
213
|
- spec/fixtures/sphinxapi.1.10.php
|
185
214
|
- spec/fixtures/sphinxapi.2.0.1.php
|
215
|
+
- spec/fixtures/sphinxapi.2.1.0.php
|
186
216
|
- spec/fixtures/sql/conf.example.yml
|
187
217
|
- spec/fixtures/sql/data.sql
|
188
218
|
- spec/fixtures/sql/data.tsv
|
@@ -234,7 +264,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
234
264
|
version: '0'
|
235
265
|
segments:
|
236
266
|
- 0
|
237
|
-
hash: -
|
267
|
+
hash: -2420399523402402729
|
238
268
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
239
269
|
none: false
|
240
270
|
requirements:
|
@@ -243,7 +273,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
243
273
|
version: '0'
|
244
274
|
segments:
|
245
275
|
- 0
|
246
|
-
hash: -
|
276
|
+
hash: -2420399523402402729
|
247
277
|
requirements: []
|
248
278
|
rubyforge_project: riddle
|
249
279
|
rubygems_version: 1.8.10
|
@@ -333,16 +363,45 @@ test_files:
|
|
333
363
|
- spec/fixtures/data/2.0.1/sort.bin
|
334
364
|
- spec/fixtures/data/2.0.1/update_simple.bin
|
335
365
|
- spec/fixtures/data/2.0.1/weights.bin
|
366
|
+
- spec/fixtures/data/2.1.0/anchor.bin
|
367
|
+
- spec/fixtures/data/2.1.0/any.bin
|
368
|
+
- spec/fixtures/data/2.1.0/boolean.bin
|
369
|
+
- spec/fixtures/data/2.1.0/comment.bin
|
370
|
+
- spec/fixtures/data/2.1.0/distinct.bin
|
371
|
+
- spec/fixtures/data/2.1.0/field_weights.bin
|
372
|
+
- spec/fixtures/data/2.1.0/filter.bin
|
373
|
+
- spec/fixtures/data/2.1.0/filter_array.bin
|
374
|
+
- spec/fixtures/data/2.1.0/filter_array_exclude.bin
|
375
|
+
- spec/fixtures/data/2.1.0/filter_boolean.bin
|
376
|
+
- spec/fixtures/data/2.1.0/filter_floats.bin
|
377
|
+
- spec/fixtures/data/2.1.0/filter_floats_exclude.bin
|
378
|
+
- spec/fixtures/data/2.1.0/filter_range.bin
|
379
|
+
- spec/fixtures/data/2.1.0/filter_range_exclude.bin
|
380
|
+
- spec/fixtures/data/2.1.0/group.bin
|
381
|
+
- spec/fixtures/data/2.1.0/index.bin
|
382
|
+
- spec/fixtures/data/2.1.0/index_weights.bin
|
383
|
+
- spec/fixtures/data/2.1.0/keywords_with_hits.bin
|
384
|
+
- spec/fixtures/data/2.1.0/keywords_without_hits.bin
|
385
|
+
- spec/fixtures/data/2.1.0/overrides.bin
|
386
|
+
- spec/fixtures/data/2.1.0/phrase.bin
|
387
|
+
- spec/fixtures/data/2.1.0/rank_mode.bin
|
388
|
+
- spec/fixtures/data/2.1.0/select.bin
|
389
|
+
- spec/fixtures/data/2.1.0/simple.bin
|
390
|
+
- spec/fixtures/data/2.1.0/sort.bin
|
391
|
+
- spec/fixtures/data/2.1.0/update_simple.bin
|
392
|
+
- spec/fixtures/data/2.1.0/weights.bin
|
336
393
|
- spec/fixtures/data_generator.0.9.8.php
|
337
394
|
- spec/fixtures/data_generator.0.9.9.php
|
338
395
|
- spec/fixtures/data_generator.1.10.php
|
339
396
|
- spec/fixtures/data_generator.2.0.1.php
|
397
|
+
- spec/fixtures/data_generator.2.1.0.php
|
340
398
|
- spec/fixtures/data_generator.php
|
341
399
|
- spec/fixtures/sphinx/configuration.erb
|
342
400
|
- spec/fixtures/sphinxapi.0.9.8.php
|
343
401
|
- spec/fixtures/sphinxapi.0.9.9.php
|
344
402
|
- spec/fixtures/sphinxapi.1.10.php
|
345
403
|
- spec/fixtures/sphinxapi.2.0.1.php
|
404
|
+
- spec/fixtures/sphinxapi.2.1.0.php
|
346
405
|
- spec/fixtures/sql/conf.example.yml
|
347
406
|
- spec/fixtures/sql/data.sql
|
348
407
|
- spec/fixtures/sql/data.tsv
|
@@ -380,3 +439,4 @@ test_files:
|
|
380
439
|
- spec/unit/message_spec.rb
|
381
440
|
- spec/unit/response_spec.rb
|
382
441
|
- spec/unit/riddle_spec.rb
|
442
|
+
has_rdoc:
|