riddle 1.4.0 → 1.5.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +6 -0
- data/.travis.yml +16 -0
- data/Gemfile +6 -0
- data/HISTORY +45 -0
- data/LICENCE +20 -0
- data/README.textile +5 -3
- data/Rakefile +23 -0
- data/lib/riddle.rb +1 -0
- data/lib/riddle/0.9.9/configuration/searchd.rb +10 -8
- data/lib/riddle/auto_version.rb +2 -2
- data/lib/riddle/client.rb +117 -118
- data/lib/riddle/configuration.rb +6 -6
- data/lib/riddle/configuration/distributed_index.rb +16 -16
- data/lib/riddle/configuration/sql_source.rb +5 -5
- data/lib/riddle/controller.rb +28 -25
- data/lib/riddle/query.rb +31 -20
- data/lib/riddle/query/select.rb +69 -8
- data/lib/riddle/version.rb +3 -0
- data/riddle.gemspec +25 -0
- data/spec/fixtures/.gitignore +2 -0
- data/spec/fixtures/data/0.9.9/anchor.bin +0 -0
- data/spec/fixtures/data/0.9.9/any.bin +0 -0
- data/spec/fixtures/data/0.9.9/boolean.bin +0 -0
- data/spec/fixtures/data/0.9.9/comment.bin +0 -0
- data/spec/fixtures/data/0.9.9/distinct.bin +0 -0
- data/spec/fixtures/data/0.9.9/field_weights.bin +0 -0
- data/spec/fixtures/data/0.9.9/filter.bin +0 -0
- data/spec/fixtures/data/0.9.9/filter_array.bin +0 -0
- data/spec/fixtures/data/0.9.9/filter_array_exclude.bin +0 -0
- data/spec/fixtures/data/0.9.9/filter_boolean.bin +0 -0
- data/spec/fixtures/data/0.9.9/filter_floats.bin +0 -0
- data/spec/fixtures/data/0.9.9/filter_floats_exclude.bin +0 -0
- data/spec/fixtures/data/0.9.9/filter_range.bin +0 -0
- data/spec/fixtures/data/0.9.9/filter_range_exclude.bin +0 -0
- data/spec/fixtures/data/0.9.9/group.bin +0 -0
- data/spec/fixtures/data/0.9.9/index.bin +0 -0
- data/spec/fixtures/data/0.9.9/index_weights.bin +0 -0
- data/spec/fixtures/data/0.9.9/keywords_with_hits.bin +0 -0
- data/spec/fixtures/data/0.9.9/keywords_without_hits.bin +0 -0
- data/spec/fixtures/data/0.9.9/overrides.bin +0 -0
- data/spec/fixtures/data/0.9.9/phrase.bin +0 -0
- data/spec/fixtures/data/0.9.9/rank_mode.bin +0 -0
- data/spec/fixtures/data/0.9.9/select.bin +0 -0
- data/spec/fixtures/data/0.9.9/simple.bin +0 -0
- data/spec/fixtures/data/0.9.9/sort.bin +0 -0
- data/spec/fixtures/data/0.9.9/update_simple.bin +0 -0
- data/spec/fixtures/data/0.9.9/weights.bin +0 -0
- data/spec/fixtures/data/1.10/anchor.bin +0 -0
- data/spec/fixtures/data/1.10/any.bin +0 -0
- data/spec/fixtures/data/1.10/boolean.bin +0 -0
- data/spec/fixtures/data/1.10/comment.bin +0 -0
- data/spec/fixtures/data/1.10/distinct.bin +0 -0
- data/spec/fixtures/data/1.10/field_weights.bin +0 -0
- data/spec/fixtures/data/1.10/filter.bin +0 -0
- data/spec/fixtures/data/1.10/filter_array.bin +0 -0
- data/spec/fixtures/data/1.10/filter_array_exclude.bin +0 -0
- data/spec/fixtures/data/1.10/filter_boolean.bin +0 -0
- data/spec/fixtures/data/1.10/filter_floats.bin +0 -0
- data/spec/fixtures/data/1.10/filter_floats_exclude.bin +0 -0
- data/spec/fixtures/data/1.10/filter_range.bin +0 -0
- data/spec/fixtures/data/1.10/filter_range_exclude.bin +0 -0
- data/spec/fixtures/data/1.10/group.bin +0 -0
- data/spec/fixtures/data/1.10/index.bin +0 -0
- data/spec/fixtures/data/1.10/index_weights.bin +0 -0
- data/spec/fixtures/data/1.10/keywords_with_hits.bin +0 -0
- data/spec/fixtures/data/1.10/keywords_without_hits.bin +0 -0
- data/spec/fixtures/data/1.10/overrides.bin +0 -0
- data/spec/fixtures/data/1.10/phrase.bin +0 -0
- data/spec/fixtures/data/1.10/rank_mode.bin +0 -0
- data/spec/fixtures/data/1.10/select.bin +0 -0
- data/spec/fixtures/data/1.10/simple.bin +0 -0
- data/spec/fixtures/data/1.10/sort.bin +0 -0
- data/spec/fixtures/data/1.10/update_simple.bin +0 -0
- data/spec/fixtures/data/1.10/weights.bin +0 -0
- data/spec/fixtures/data/2.0.1/anchor.bin +0 -0
- data/spec/fixtures/data/2.0.1/any.bin +0 -0
- data/spec/fixtures/data/2.0.1/boolean.bin +0 -0
- data/spec/fixtures/data/2.0.1/comment.bin +0 -0
- data/spec/fixtures/data/2.0.1/distinct.bin +0 -0
- data/spec/fixtures/data/2.0.1/field_weights.bin +0 -0
- data/spec/fixtures/data/2.0.1/filter.bin +0 -0
- data/spec/fixtures/data/2.0.1/filter_array.bin +0 -0
- data/spec/fixtures/data/2.0.1/filter_array_exclude.bin +0 -0
- data/spec/fixtures/data/2.0.1/filter_boolean.bin +0 -0
- data/spec/fixtures/data/2.0.1/filter_floats.bin +0 -0
- data/spec/fixtures/data/2.0.1/filter_floats_exclude.bin +0 -0
- data/spec/fixtures/data/2.0.1/filter_range.bin +0 -0
- data/spec/fixtures/data/2.0.1/filter_range_exclude.bin +0 -0
- data/spec/fixtures/data/2.0.1/group.bin +0 -0
- data/spec/fixtures/data/2.0.1/index.bin +0 -0
- data/spec/fixtures/data/2.0.1/index_weights.bin +0 -0
- data/spec/fixtures/data/2.0.1/keywords_with_hits.bin +0 -0
- data/spec/fixtures/data/2.0.1/keywords_without_hits.bin +0 -0
- data/spec/fixtures/data/2.0.1/overrides.bin +0 -0
- data/spec/fixtures/data/2.0.1/phrase.bin +0 -0
- data/spec/fixtures/data/2.0.1/rank_mode.bin +0 -0
- data/spec/fixtures/data/2.0.1/select.bin +0 -0
- data/spec/fixtures/data/2.0.1/simple.bin +0 -0
- data/spec/fixtures/data/2.0.1/sort.bin +0 -0
- data/spec/fixtures/data/2.0.1/update_simple.bin +0 -0
- data/spec/fixtures/data/2.0.1/weights.bin +0 -0
- data/spec/fixtures/data_generator.0.9.8.php +208 -0
- data/spec/fixtures/data_generator.0.9.9.php +5 -0
- data/spec/fixtures/data_generator.1.10.php +5 -0
- data/spec/fixtures/data_generator.2.0.1.php +5 -0
- data/spec/fixtures/data_generator.php +223 -0
- data/spec/fixtures/sphinxapi.0.9.8.php +1228 -0
- data/spec/fixtures/sphinxapi.0.9.9.php +1646 -0
- data/spec/fixtures/sphinxapi.1.10.php +1728 -0
- data/spec/fixtures/sphinxapi.2.0.1.php +1731 -0
- data/spec/fixtures/sql/conf.example.yml +3 -0
- data/spec/fixtures/sql/data.sql +25000 -0
- data/spec/fixtures/sql/data.tsv +25000 -0
- data/spec/fixtures/sql/structure.sql +16 -0
- data/spec/functional/connection_spec.rb +10 -12
- data/spec/functional/excerpt_spec.rb +1 -1
- data/spec/functional/keywords_spec.rb +1 -1
- data/spec/functional/persistance_spec.rb +1 -1
- data/spec/functional/search_spec.rb +1 -1
- data/spec/functional/status_spec.rb +1 -1
- data/spec/functional/update_spec.rb +1 -1
- data/spec/riddle/auto_version_spec.rb +18 -10
- data/spec/riddle/query/select_spec.rb +78 -14
- data/spec/riddle/query_spec.rb +5 -3
- data/spec/spec_helper.rb +13 -15
- data/spec/support/binary_fixtures.rb +18 -0
- data/spec/support/sphinx.rb +135 -0
- data/spec/unit/client_spec.rb +150 -142
- data/spec/unit/configuration/distributed_index_spec.rb +15 -15
- data/spec/unit/configuration/searchd_spec.rb +28 -3
- data/spec/unit/configuration_spec.rb +6 -6
- metadata +254 -68
- data/spec/sphinx_helper.rb +0 -96
data/spec/unit/client_spec.rb
CHANGED
@@ -13,6 +13,12 @@ describe Riddle::Client do
|
|
13
13
|
it "should default to port 9312" do
|
14
14
|
Riddle::Client.new.port.should == 9312
|
15
15
|
end
|
16
|
+
|
17
|
+
it "should accept an array of servers" do
|
18
|
+
servers = ["1.1.1.1", "2.2.2.2", "3.3.3.3"]
|
19
|
+
client = Riddle::Client.new(servers)
|
20
|
+
client.servers.should == servers
|
21
|
+
end
|
16
22
|
|
17
23
|
it "should translate anchor arguments correctly" do
|
18
24
|
client = Riddle::Client.new
|
@@ -32,182 +38,184 @@ describe Riddle::Client do
|
|
32
38
|
client.queue.should_not be_empty
|
33
39
|
end
|
34
40
|
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
41
|
+
describe 'query contents' do
|
42
|
+
it "should build a basic search message correctly" do
|
43
|
+
client = Riddle::Client.new
|
44
|
+
client.append_query "test "
|
45
|
+
client.queue.first.should == query_contents(:simple)
|
46
|
+
end
|
40
47
|
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
48
|
+
it "should build a message with a specified index correctly" do
|
49
|
+
client = Riddle::Client.new
|
50
|
+
client.append_query "test ", "edition"
|
51
|
+
client.queue.first.should == query_contents(:index)
|
52
|
+
end
|
46
53
|
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
54
|
+
it "should build a message using match mode :any correctly" do
|
55
|
+
client = Riddle::Client.new
|
56
|
+
client.match_mode = :any
|
57
|
+
client.append_query "test this "
|
58
|
+
client.queue.first.should == query_contents(:any)
|
59
|
+
end
|
53
60
|
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
+
it "should build a message using sort by correctly" do
|
62
|
+
client = Riddle::Client.new
|
63
|
+
client.sort_by = 'id'
|
64
|
+
client.sort_mode = :extended
|
65
|
+
client.append_query "testing "
|
66
|
+
client.queue.first.should == query_contents(:sort)
|
67
|
+
end
|
61
68
|
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
69
|
+
it "should build a message using match mode :boolean correctly" do
|
70
|
+
client = Riddle::Client.new
|
71
|
+
client.match_mode = :boolean
|
72
|
+
client.append_query "test "
|
73
|
+
client.queue.first.should == query_contents(:boolean)
|
74
|
+
end
|
68
75
|
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
76
|
+
it "should build a message using match mode :phrase correctly" do
|
77
|
+
client = Riddle::Client.new
|
78
|
+
client.match_mode = :phrase
|
79
|
+
client.append_query "testing this "
|
80
|
+
client.queue.first.should == query_contents(:phrase)
|
81
|
+
end
|
75
82
|
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
83
|
+
it "should build a message with a filter correctly" do
|
84
|
+
client = Riddle::Client.new
|
85
|
+
client.filters << Riddle::Client::Filter.new("id", [10, 100, 1000])
|
86
|
+
client.append_query "test "
|
87
|
+
client.queue.first.should == query_contents(:filter)
|
88
|
+
end
|
82
89
|
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
90
|
+
it "should build a message with group values correctly" do
|
91
|
+
client = Riddle::Client.new
|
92
|
+
client.group_by = "id"
|
93
|
+
client.group_function = :attr
|
94
|
+
client.group_clause = "id"
|
95
|
+
client.append_query "test "
|
96
|
+
client.queue.first.should == query_contents(:group)
|
97
|
+
end
|
91
98
|
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
99
|
+
it "should build a message with group distinct value correctly" do
|
100
|
+
client = Riddle::Client.new
|
101
|
+
client.group_distinct = "id"
|
102
|
+
client.append_query "test "
|
103
|
+
client.queue.first.should == query_contents(:distinct)
|
104
|
+
end
|
98
105
|
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
106
|
+
it "should build a message with weights correctly" do
|
107
|
+
client = Riddle::Client.new
|
108
|
+
client.weights = [100, 1]
|
109
|
+
client.append_query "test "
|
110
|
+
client.queue.first.should == query_contents(:weights)
|
111
|
+
end
|
105
112
|
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
113
|
+
it "should build a message with an anchor correctly" do
|
114
|
+
client = Riddle::Client.new
|
115
|
+
client.set_anchor "latitude", 10.0, "longitude", 95.0
|
116
|
+
client.append_query "test "
|
117
|
+
client.queue.first.should == query_contents(:anchor)
|
118
|
+
end
|
112
119
|
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
120
|
+
it "should build a message with index weights correctly" do
|
121
|
+
client = Riddle::Client.new
|
122
|
+
client.index_weights = {"people" => 101}
|
123
|
+
client.append_query "test "
|
124
|
+
client.queue.first.should == query_contents(:index_weights)
|
125
|
+
end
|
119
126
|
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
127
|
+
it "should build a message with field weights correctly" do
|
128
|
+
client = Riddle::Client.new
|
129
|
+
client.field_weights = {"city" => 101}
|
130
|
+
client.append_query "test "
|
131
|
+
client.queue.first.should == query_contents(:field_weights)
|
132
|
+
end
|
126
133
|
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
134
|
+
it "should build a message with a comment correctly" do
|
135
|
+
client = Riddle::Client.new
|
136
|
+
client.append_query "test ", "*", "commenting"
|
137
|
+
client.queue.first.should == query_contents(:comment)
|
138
|
+
end
|
139
|
+
|
140
|
+
if Riddle.loaded_version == '0.9.9' || Riddle.loaded_version == '1.10'
|
141
|
+
it "should build a message with overrides correctly" do
|
142
|
+
client = Riddle::Client.new
|
143
|
+
client.add_override("rating", :float, {1 => 10.0})
|
144
|
+
client.append_query "test "
|
145
|
+
client.queue.first.should == query_contents(:overrides)
|
146
|
+
end
|
147
|
+
|
148
|
+
it "should build a message with selects correctly" do
|
149
|
+
client = Riddle::Client.new
|
150
|
+
client.select = "selecting"
|
151
|
+
client.append_query "test "
|
152
|
+
client.queue.first.should == query_contents(:select)
|
153
|
+
end
|
154
|
+
end
|
132
155
|
|
133
|
-
|
134
|
-
it "should build a message with overrides correctly" do
|
156
|
+
it "should keep multiple messages in the queue" do
|
135
157
|
client = Riddle::Client.new
|
136
|
-
client.
|
158
|
+
client.weights = [100, 1]
|
159
|
+
client.append_query "test "
|
137
160
|
client.append_query "test "
|
138
|
-
client.queue.
|
161
|
+
client.queue.length.should == 2
|
162
|
+
client.queue.each { |item| item.should == query_contents(:weights) }
|
139
163
|
end
|
140
164
|
|
141
|
-
it "should
|
165
|
+
it "should keep multiple messages in the queue with different params" do
|
142
166
|
client = Riddle::Client.new
|
143
|
-
client.
|
167
|
+
client.weights = [100, 1]
|
144
168
|
client.append_query "test "
|
145
|
-
client.
|
169
|
+
client.weights = []
|
170
|
+
client.append_query "test ", "edition"
|
171
|
+
client.queue.first.should == query_contents(:weights)
|
172
|
+
client.queue.last.should == query_contents(:index)
|
146
173
|
end
|
147
|
-
end
|
148
|
-
|
149
|
-
it "should keep multiple messages in the queue" do
|
150
|
-
client = Riddle::Client.new
|
151
|
-
client.weights = [100, 1]
|
152
|
-
client.append_query "test "
|
153
|
-
client.append_query "test "
|
154
|
-
client.queue.length.should == 2
|
155
|
-
client.queue.each { |item| item.should == query_contents(:weights) }
|
156
|
-
end
|
157
174
|
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
it "should build a basic update message correctly" do
|
169
|
-
client = Riddle::Client.new
|
170
|
-
client.send(
|
171
|
-
:update_message,
|
172
|
-
"people",
|
173
|
-
["birthday"],
|
174
|
-
{1 => [191163600]}
|
175
|
-
).should == query_contents(:update_simple)
|
176
|
-
end
|
175
|
+
it "should build a basic update message correctly" do
|
176
|
+
client = Riddle::Client.new
|
177
|
+
client.send(
|
178
|
+
:update_message,
|
179
|
+
"people",
|
180
|
+
["birthday"],
|
181
|
+
{1 => [191163600]}
|
182
|
+
).should == query_contents(:update_simple)
|
183
|
+
end
|
177
184
|
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
185
|
+
it "should build a keywords request without hits correctly" do
|
186
|
+
client = Riddle::Client.new
|
187
|
+
client.send(
|
188
|
+
:keywords_message,
|
189
|
+
"pat",
|
190
|
+
"people",
|
191
|
+
false
|
192
|
+
).should == query_contents(:keywords_without_hits)
|
193
|
+
end
|
187
194
|
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
195
|
+
it "should build a keywords request with hits correctly" do
|
196
|
+
client = Riddle::Client.new
|
197
|
+
client.send(
|
198
|
+
:keywords_message,
|
199
|
+
"pat",
|
200
|
+
"people",
|
201
|
+
true
|
202
|
+
).should == query_contents(:keywords_with_hits)
|
203
|
+
end
|
196
204
|
end
|
197
205
|
|
198
206
|
it "should timeout after a specified time" do
|
199
207
|
client = Riddle::Client.new
|
200
|
-
client.port =
|
208
|
+
client.port = 9314
|
201
209
|
client.timeout = 1
|
202
210
|
|
203
|
-
server = TCPServer.new "localhost",
|
211
|
+
server = TCPServer.new "localhost", 9314
|
204
212
|
|
205
213
|
lambda {
|
206
214
|
client.send(:connect) { |socket| }
|
207
215
|
}.should raise_error(Riddle::ConnectionError)
|
208
216
|
|
209
217
|
server.close
|
210
|
-
end
|
218
|
+
end unless RUBY_PLATFORM == 'java' # JRuby doesn't like Timeout
|
211
219
|
|
212
220
|
context "connection retrying" do
|
213
221
|
it "should try fives time when connection refused" do
|
@@ -237,7 +245,7 @@ describe Riddle::Client do
|
|
237
245
|
lambda {
|
238
246
|
client.send(:connect) { |socket| }
|
239
247
|
}.should raise_error(Riddle::ConnectionError)
|
240
|
-
end
|
248
|
+
end unless RUBY_PLATFORM == 'java' # JRuby doesn't like Timeout
|
241
249
|
|
242
250
|
it "should try each of several server addresses after a connection refused" do
|
243
251
|
client = Riddle::Client.new
|
@@ -255,6 +263,6 @@ describe Riddle::Client do
|
|
255
263
|
lambda {
|
256
264
|
client.send(:connect) { |socket| }
|
257
265
|
}.should raise_error(Riddle::ConnectionError)
|
258
|
-
end
|
266
|
+
end unless RUBY_PLATFORM == 'java' # JRuby doesn't like Timeout
|
259
267
|
end
|
260
268
|
end
|
@@ -1,46 +1,46 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
describe Riddle::Configuration::DistributedIndex do
|
4
|
-
it "should not be valid without any
|
4
|
+
it "should not be valid without any indices" do
|
5
5
|
index = Riddle::Configuration::DistributedIndex.new("dist1")
|
6
6
|
index.should_not be_valid
|
7
7
|
end
|
8
|
-
|
9
|
-
it "should be valid with just local
|
8
|
+
|
9
|
+
it "should be valid with just local indices" do
|
10
10
|
index = Riddle::Configuration::DistributedIndex.new("dist1")
|
11
|
-
index.
|
11
|
+
index.local_indices << "local_one"
|
12
12
|
index.should be_valid
|
13
13
|
end
|
14
|
-
|
15
|
-
it "should be valid with just remote
|
14
|
+
|
15
|
+
it "should be valid with just remote indices" do
|
16
16
|
index = Riddle::Configuration::DistributedIndex.new("dist1")
|
17
|
-
index.
|
17
|
+
index.remote_indices << Riddle::Configuration::RemoteIndex.new("local", 3312, "remote_one")
|
18
18
|
index.should be_valid
|
19
19
|
end
|
20
|
-
|
20
|
+
|
21
21
|
it "should be of type 'distributed'" do
|
22
22
|
index = Riddle::Configuration::DistributedIndex.new("dist1")
|
23
23
|
index.type.should == 'distributed'
|
24
24
|
end
|
25
|
-
|
25
|
+
|
26
26
|
it "should raise a ConfigurationError if rendering when not valid" do
|
27
27
|
index = Riddle::Configuration::DistributedIndex.new("dist1")
|
28
28
|
lambda { index.render }.should raise_error(Riddle::Configuration::ConfigurationError)
|
29
29
|
end
|
30
|
-
|
30
|
+
|
31
31
|
it "should render correctly if supplied settings are valid" do
|
32
32
|
index = Riddle::Configuration::DistributedIndex.new("dist1")
|
33
|
-
|
34
|
-
index.
|
35
|
-
index.
|
33
|
+
|
34
|
+
index.local_indices << "test1" << "test1stemmed"
|
35
|
+
index.remote_indices <<
|
36
36
|
Riddle::Configuration::RemoteIndex.new("localhost", 3313, "remote1") <<
|
37
37
|
Riddle::Configuration::RemoteIndex.new("localhost", 3314, "remote2") <<
|
38
38
|
Riddle::Configuration::RemoteIndex.new("localhost", 3314, "remote3")
|
39
39
|
index.agent_blackhole << "testbox:3312:testindex1,testindex2"
|
40
|
-
|
40
|
+
|
41
41
|
index.agent_connect_timeout = 1000
|
42
42
|
index.agent_query_timeout = 3000
|
43
|
-
|
43
|
+
|
44
44
|
index.render.should == <<-DISTINDEX
|
45
45
|
index dist1
|
46
46
|
{
|
@@ -54,12 +54,37 @@ describe Riddle::Configuration::Searchd do
|
|
54
54
|
searchd.should respond_to("#{setting}=".to_sym)
|
55
55
|
end
|
56
56
|
end
|
57
|
-
|
57
|
+
|
58
|
+
it "should support setting listen to a port number" do
|
59
|
+
searchd = Riddle::Configuration::Searchd.new
|
60
|
+
searchd.port = 3312
|
61
|
+
searchd.pid_file = "file.pid"
|
62
|
+
searchd.listen = 3312
|
63
|
+
|
64
|
+
if Riddle.loaded_version.to_f >= 0.9
|
65
|
+
searchd.render.should == <<-SEARCHD
|
66
|
+
searchd
|
67
|
+
{
|
68
|
+
listen = 3312
|
69
|
+
pid_file = file.pid
|
70
|
+
}
|
71
|
+
SEARCHD
|
72
|
+
else
|
73
|
+
searchd.render.should == <<-SEARCHD
|
74
|
+
searchd
|
75
|
+
{
|
76
|
+
port = 3312
|
77
|
+
pid_file = file.pid
|
78
|
+
}
|
79
|
+
SEARCHD
|
80
|
+
end
|
81
|
+
end
|
82
|
+
|
58
83
|
it "should render a correct configuration with valid settings" do
|
59
84
|
searchd = Riddle::Configuration::Searchd.new
|
60
85
|
searchd.port = 3312
|
61
86
|
searchd.pid_file = "file.pid"
|
62
|
-
|
87
|
+
|
63
88
|
if Riddle.loaded_version.to_f >= 0.9
|
64
89
|
searchd.render.should == <<-SEARCHD
|
65
90
|
searchd
|
@@ -78,7 +103,7 @@ searchd
|
|
78
103
|
SEARCHD
|
79
104
|
end
|
80
105
|
end
|
81
|
-
|
106
|
+
|
82
107
|
it "should render with a client key if one is provided" do
|
83
108
|
searchd = Riddle::Configuration::Searchd.new
|
84
109
|
searchd.port = 3312
|