riddle 1.4.0 → 1.5.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (133) hide show
  1. data/.gitignore +6 -0
  2. data/.travis.yml +16 -0
  3. data/Gemfile +6 -0
  4. data/HISTORY +45 -0
  5. data/LICENCE +20 -0
  6. data/README.textile +5 -3
  7. data/Rakefile +23 -0
  8. data/lib/riddle.rb +1 -0
  9. data/lib/riddle/0.9.9/configuration/searchd.rb +10 -8
  10. data/lib/riddle/auto_version.rb +2 -2
  11. data/lib/riddle/client.rb +117 -118
  12. data/lib/riddle/configuration.rb +6 -6
  13. data/lib/riddle/configuration/distributed_index.rb +16 -16
  14. data/lib/riddle/configuration/sql_source.rb +5 -5
  15. data/lib/riddle/controller.rb +28 -25
  16. data/lib/riddle/query.rb +31 -20
  17. data/lib/riddle/query/select.rb +69 -8
  18. data/lib/riddle/version.rb +3 -0
  19. data/riddle.gemspec +25 -0
  20. data/spec/fixtures/.gitignore +2 -0
  21. data/spec/fixtures/data/0.9.9/anchor.bin +0 -0
  22. data/spec/fixtures/data/0.9.9/any.bin +0 -0
  23. data/spec/fixtures/data/0.9.9/boolean.bin +0 -0
  24. data/spec/fixtures/data/0.9.9/comment.bin +0 -0
  25. data/spec/fixtures/data/0.9.9/distinct.bin +0 -0
  26. data/spec/fixtures/data/0.9.9/field_weights.bin +0 -0
  27. data/spec/fixtures/data/0.9.9/filter.bin +0 -0
  28. data/spec/fixtures/data/0.9.9/filter_array.bin +0 -0
  29. data/spec/fixtures/data/0.9.9/filter_array_exclude.bin +0 -0
  30. data/spec/fixtures/data/0.9.9/filter_boolean.bin +0 -0
  31. data/spec/fixtures/data/0.9.9/filter_floats.bin +0 -0
  32. data/spec/fixtures/data/0.9.9/filter_floats_exclude.bin +0 -0
  33. data/spec/fixtures/data/0.9.9/filter_range.bin +0 -0
  34. data/spec/fixtures/data/0.9.9/filter_range_exclude.bin +0 -0
  35. data/spec/fixtures/data/0.9.9/group.bin +0 -0
  36. data/spec/fixtures/data/0.9.9/index.bin +0 -0
  37. data/spec/fixtures/data/0.9.9/index_weights.bin +0 -0
  38. data/spec/fixtures/data/0.9.9/keywords_with_hits.bin +0 -0
  39. data/spec/fixtures/data/0.9.9/keywords_without_hits.bin +0 -0
  40. data/spec/fixtures/data/0.9.9/overrides.bin +0 -0
  41. data/spec/fixtures/data/0.9.9/phrase.bin +0 -0
  42. data/spec/fixtures/data/0.9.9/rank_mode.bin +0 -0
  43. data/spec/fixtures/data/0.9.9/select.bin +0 -0
  44. data/spec/fixtures/data/0.9.9/simple.bin +0 -0
  45. data/spec/fixtures/data/0.9.9/sort.bin +0 -0
  46. data/spec/fixtures/data/0.9.9/update_simple.bin +0 -0
  47. data/spec/fixtures/data/0.9.9/weights.bin +0 -0
  48. data/spec/fixtures/data/1.10/anchor.bin +0 -0
  49. data/spec/fixtures/data/1.10/any.bin +0 -0
  50. data/spec/fixtures/data/1.10/boolean.bin +0 -0
  51. data/spec/fixtures/data/1.10/comment.bin +0 -0
  52. data/spec/fixtures/data/1.10/distinct.bin +0 -0
  53. data/spec/fixtures/data/1.10/field_weights.bin +0 -0
  54. data/spec/fixtures/data/1.10/filter.bin +0 -0
  55. data/spec/fixtures/data/1.10/filter_array.bin +0 -0
  56. data/spec/fixtures/data/1.10/filter_array_exclude.bin +0 -0
  57. data/spec/fixtures/data/1.10/filter_boolean.bin +0 -0
  58. data/spec/fixtures/data/1.10/filter_floats.bin +0 -0
  59. data/spec/fixtures/data/1.10/filter_floats_exclude.bin +0 -0
  60. data/spec/fixtures/data/1.10/filter_range.bin +0 -0
  61. data/spec/fixtures/data/1.10/filter_range_exclude.bin +0 -0
  62. data/spec/fixtures/data/1.10/group.bin +0 -0
  63. data/spec/fixtures/data/1.10/index.bin +0 -0
  64. data/spec/fixtures/data/1.10/index_weights.bin +0 -0
  65. data/spec/fixtures/data/1.10/keywords_with_hits.bin +0 -0
  66. data/spec/fixtures/data/1.10/keywords_without_hits.bin +0 -0
  67. data/spec/fixtures/data/1.10/overrides.bin +0 -0
  68. data/spec/fixtures/data/1.10/phrase.bin +0 -0
  69. data/spec/fixtures/data/1.10/rank_mode.bin +0 -0
  70. data/spec/fixtures/data/1.10/select.bin +0 -0
  71. data/spec/fixtures/data/1.10/simple.bin +0 -0
  72. data/spec/fixtures/data/1.10/sort.bin +0 -0
  73. data/spec/fixtures/data/1.10/update_simple.bin +0 -0
  74. data/spec/fixtures/data/1.10/weights.bin +0 -0
  75. data/spec/fixtures/data/2.0.1/anchor.bin +0 -0
  76. data/spec/fixtures/data/2.0.1/any.bin +0 -0
  77. data/spec/fixtures/data/2.0.1/boolean.bin +0 -0
  78. data/spec/fixtures/data/2.0.1/comment.bin +0 -0
  79. data/spec/fixtures/data/2.0.1/distinct.bin +0 -0
  80. data/spec/fixtures/data/2.0.1/field_weights.bin +0 -0
  81. data/spec/fixtures/data/2.0.1/filter.bin +0 -0
  82. data/spec/fixtures/data/2.0.1/filter_array.bin +0 -0
  83. data/spec/fixtures/data/2.0.1/filter_array_exclude.bin +0 -0
  84. data/spec/fixtures/data/2.0.1/filter_boolean.bin +0 -0
  85. data/spec/fixtures/data/2.0.1/filter_floats.bin +0 -0
  86. data/spec/fixtures/data/2.0.1/filter_floats_exclude.bin +0 -0
  87. data/spec/fixtures/data/2.0.1/filter_range.bin +0 -0
  88. data/spec/fixtures/data/2.0.1/filter_range_exclude.bin +0 -0
  89. data/spec/fixtures/data/2.0.1/group.bin +0 -0
  90. data/spec/fixtures/data/2.0.1/index.bin +0 -0
  91. data/spec/fixtures/data/2.0.1/index_weights.bin +0 -0
  92. data/spec/fixtures/data/2.0.1/keywords_with_hits.bin +0 -0
  93. data/spec/fixtures/data/2.0.1/keywords_without_hits.bin +0 -0
  94. data/spec/fixtures/data/2.0.1/overrides.bin +0 -0
  95. data/spec/fixtures/data/2.0.1/phrase.bin +0 -0
  96. data/spec/fixtures/data/2.0.1/rank_mode.bin +0 -0
  97. data/spec/fixtures/data/2.0.1/select.bin +0 -0
  98. data/spec/fixtures/data/2.0.1/simple.bin +0 -0
  99. data/spec/fixtures/data/2.0.1/sort.bin +0 -0
  100. data/spec/fixtures/data/2.0.1/update_simple.bin +0 -0
  101. data/spec/fixtures/data/2.0.1/weights.bin +0 -0
  102. data/spec/fixtures/data_generator.0.9.8.php +208 -0
  103. data/spec/fixtures/data_generator.0.9.9.php +5 -0
  104. data/spec/fixtures/data_generator.1.10.php +5 -0
  105. data/spec/fixtures/data_generator.2.0.1.php +5 -0
  106. data/spec/fixtures/data_generator.php +223 -0
  107. data/spec/fixtures/sphinxapi.0.9.8.php +1228 -0
  108. data/spec/fixtures/sphinxapi.0.9.9.php +1646 -0
  109. data/spec/fixtures/sphinxapi.1.10.php +1728 -0
  110. data/spec/fixtures/sphinxapi.2.0.1.php +1731 -0
  111. data/spec/fixtures/sql/conf.example.yml +3 -0
  112. data/spec/fixtures/sql/data.sql +25000 -0
  113. data/spec/fixtures/sql/data.tsv +25000 -0
  114. data/spec/fixtures/sql/structure.sql +16 -0
  115. data/spec/functional/connection_spec.rb +10 -12
  116. data/spec/functional/excerpt_spec.rb +1 -1
  117. data/spec/functional/keywords_spec.rb +1 -1
  118. data/spec/functional/persistance_spec.rb +1 -1
  119. data/spec/functional/search_spec.rb +1 -1
  120. data/spec/functional/status_spec.rb +1 -1
  121. data/spec/functional/update_spec.rb +1 -1
  122. data/spec/riddle/auto_version_spec.rb +18 -10
  123. data/spec/riddle/query/select_spec.rb +78 -14
  124. data/spec/riddle/query_spec.rb +5 -3
  125. data/spec/spec_helper.rb +13 -15
  126. data/spec/support/binary_fixtures.rb +18 -0
  127. data/spec/support/sphinx.rb +135 -0
  128. data/spec/unit/client_spec.rb +150 -142
  129. data/spec/unit/configuration/distributed_index_spec.rb +15 -15
  130. data/spec/unit/configuration/searchd_spec.rb +28 -3
  131. data/spec/unit/configuration_spec.rb +6 -6
  132. metadata +254 -68
  133. data/spec/sphinx_helper.rb +0 -96
@@ -3,20 +3,20 @@ require 'spec_helper'
3
3
  describe Riddle::Configuration do
4
4
  it "should render all given indexes and sources, plus the indexer and search sections" do
5
5
  config = Riddle::Configuration.new
6
-
6
+
7
7
  config.searchd.port = 3312
8
8
  config.searchd.pid_file = "file.pid"
9
-
9
+
10
10
  source = Riddle::Configuration::XMLSource.new("src1", "xmlpipe")
11
11
  source.xmlpipe_command = "ls /dev/null"
12
-
12
+
13
13
  index = Riddle::Configuration::Index.new("index1")
14
14
  index.path = "/path/to/index1"
15
15
  index.sources << source
16
-
17
- config.indexes << index
16
+
17
+ config.indices << index
18
18
  generated_conf = config.render
19
-
19
+
20
20
  generated_conf.should match(/index index1/)
21
21
  generated_conf.should match(/source src1/)
22
22
  generated_conf.should match(/indexer/)
metadata CHANGED
@@ -1,72 +1,63 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: riddle
3
- version: !ruby/object:Gem::Version
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.5.0
4
5
  prerelease:
5
- version: 1.4.0
6
6
  platform: ruby
7
- authors:
7
+ authors:
8
8
  - Pat Allan
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
-
13
- date: 2011-08-02 00:00:00 +10:00
14
- default_executable:
15
- dependencies:
16
- - !ruby/object:Gem::Dependency
17
- name: mysql2
18
- requirement: &id001 !ruby/object:Gem::Requirement
12
+ date: 2011-11-04 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: rake
16
+ requirement: &70319939317800 !ruby/object:Gem::Requirement
19
17
  none: false
20
- requirements:
21
- - - "="
22
- - !ruby/object:Gem::Version
23
- version: 0.3.2
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: 0.9.2
24
22
  type: :development
25
23
  prerelease: false
26
- version_requirements: *id001
27
- - !ruby/object:Gem::Dependency
28
- name: jeweler
29
- requirement: &id002 !ruby/object:Gem::Requirement
30
- none: false
31
- requirements:
32
- - - "="
33
- - !ruby/object:Gem::Version
34
- version: 1.5.1
35
- type: :development
36
- prerelease: false
37
- version_requirements: *id002
38
- - !ruby/object:Gem::Dependency
24
+ version_requirements: *70319939317800
25
+ - !ruby/object:Gem::Dependency
39
26
  name: rspec
40
- requirement: &id003 !ruby/object:Gem::Requirement
27
+ requirement: &70319939316860 !ruby/object:Gem::Requirement
41
28
  none: false
42
- requirements:
43
- - - ">="
44
- - !ruby/object:Gem::Version
29
+ requirements:
30
+ - - ! '>='
31
+ - !ruby/object:Gem::Version
45
32
  version: 2.5.0
46
33
  type: :development
47
34
  prerelease: false
48
- version_requirements: *id003
49
- - !ruby/object:Gem::Dependency
35
+ version_requirements: *70319939316860
36
+ - !ruby/object:Gem::Dependency
50
37
  name: yard
51
- requirement: &id004 !ruby/object:Gem::Requirement
38
+ requirement: &70319939316300 !ruby/object:Gem::Requirement
52
39
  none: false
53
- requirements:
54
- - - ">="
55
- - !ruby/object:Gem::Version
56
- version: 0.6.8
40
+ requirements:
41
+ - - ! '>='
42
+ - !ruby/object:Gem::Version
43
+ version: 0.7.2
57
44
  type: :development
58
45
  prerelease: false
59
- version_requirements: *id004
46
+ version_requirements: *70319939316300
60
47
  description: A Ruby API and configuration helper for the Sphinx search service.
61
- email: pat@freelancing-gods.com
48
+ email:
49
+ - pat@freelancing-gods.com
62
50
  executables: []
63
-
64
51
  extensions: []
65
-
66
- extra_rdoc_files:
67
- - README.textile
68
- files:
52
+ extra_rdoc_files: []
53
+ files:
54
+ - .gitignore
55
+ - .travis.yml
56
+ - Gemfile
57
+ - HISTORY
58
+ - LICENCE
69
59
  - README.textile
60
+ - Rakefile
70
61
  - lib/riddle.rb
71
62
  - lib/riddle/0.9.8.rb
72
63
  - lib/riddle/0.9.9.rb
@@ -98,6 +89,104 @@ files:
98
89
  - lib/riddle/query/delete.rb
99
90
  - lib/riddle/query/insert.rb
100
91
  - lib/riddle/query/select.rb
92
+ - lib/riddle/version.rb
93
+ - riddle.gemspec
94
+ - spec/fixtures/.gitignore
95
+ - spec/fixtures/data/0.9.9/anchor.bin
96
+ - spec/fixtures/data/0.9.9/any.bin
97
+ - spec/fixtures/data/0.9.9/boolean.bin
98
+ - spec/fixtures/data/0.9.9/comment.bin
99
+ - spec/fixtures/data/0.9.9/distinct.bin
100
+ - spec/fixtures/data/0.9.9/field_weights.bin
101
+ - spec/fixtures/data/0.9.9/filter.bin
102
+ - spec/fixtures/data/0.9.9/filter_array.bin
103
+ - spec/fixtures/data/0.9.9/filter_array_exclude.bin
104
+ - spec/fixtures/data/0.9.9/filter_boolean.bin
105
+ - spec/fixtures/data/0.9.9/filter_floats.bin
106
+ - spec/fixtures/data/0.9.9/filter_floats_exclude.bin
107
+ - spec/fixtures/data/0.9.9/filter_range.bin
108
+ - spec/fixtures/data/0.9.9/filter_range_exclude.bin
109
+ - spec/fixtures/data/0.9.9/group.bin
110
+ - spec/fixtures/data/0.9.9/index.bin
111
+ - spec/fixtures/data/0.9.9/index_weights.bin
112
+ - spec/fixtures/data/0.9.9/keywords_with_hits.bin
113
+ - spec/fixtures/data/0.9.9/keywords_without_hits.bin
114
+ - spec/fixtures/data/0.9.9/overrides.bin
115
+ - spec/fixtures/data/0.9.9/phrase.bin
116
+ - spec/fixtures/data/0.9.9/rank_mode.bin
117
+ - spec/fixtures/data/0.9.9/select.bin
118
+ - spec/fixtures/data/0.9.9/simple.bin
119
+ - spec/fixtures/data/0.9.9/sort.bin
120
+ - spec/fixtures/data/0.9.9/update_simple.bin
121
+ - spec/fixtures/data/0.9.9/weights.bin
122
+ - spec/fixtures/data/1.10/anchor.bin
123
+ - spec/fixtures/data/1.10/any.bin
124
+ - spec/fixtures/data/1.10/boolean.bin
125
+ - spec/fixtures/data/1.10/comment.bin
126
+ - spec/fixtures/data/1.10/distinct.bin
127
+ - spec/fixtures/data/1.10/field_weights.bin
128
+ - spec/fixtures/data/1.10/filter.bin
129
+ - spec/fixtures/data/1.10/filter_array.bin
130
+ - spec/fixtures/data/1.10/filter_array_exclude.bin
131
+ - spec/fixtures/data/1.10/filter_boolean.bin
132
+ - spec/fixtures/data/1.10/filter_floats.bin
133
+ - spec/fixtures/data/1.10/filter_floats_exclude.bin
134
+ - spec/fixtures/data/1.10/filter_range.bin
135
+ - spec/fixtures/data/1.10/filter_range_exclude.bin
136
+ - spec/fixtures/data/1.10/group.bin
137
+ - spec/fixtures/data/1.10/index.bin
138
+ - spec/fixtures/data/1.10/index_weights.bin
139
+ - spec/fixtures/data/1.10/keywords_with_hits.bin
140
+ - spec/fixtures/data/1.10/keywords_without_hits.bin
141
+ - spec/fixtures/data/1.10/overrides.bin
142
+ - spec/fixtures/data/1.10/phrase.bin
143
+ - spec/fixtures/data/1.10/rank_mode.bin
144
+ - spec/fixtures/data/1.10/select.bin
145
+ - spec/fixtures/data/1.10/simple.bin
146
+ - spec/fixtures/data/1.10/sort.bin
147
+ - spec/fixtures/data/1.10/update_simple.bin
148
+ - spec/fixtures/data/1.10/weights.bin
149
+ - spec/fixtures/data/2.0.1/anchor.bin
150
+ - spec/fixtures/data/2.0.1/any.bin
151
+ - spec/fixtures/data/2.0.1/boolean.bin
152
+ - spec/fixtures/data/2.0.1/comment.bin
153
+ - spec/fixtures/data/2.0.1/distinct.bin
154
+ - spec/fixtures/data/2.0.1/field_weights.bin
155
+ - spec/fixtures/data/2.0.1/filter.bin
156
+ - spec/fixtures/data/2.0.1/filter_array.bin
157
+ - spec/fixtures/data/2.0.1/filter_array_exclude.bin
158
+ - spec/fixtures/data/2.0.1/filter_boolean.bin
159
+ - spec/fixtures/data/2.0.1/filter_floats.bin
160
+ - spec/fixtures/data/2.0.1/filter_floats_exclude.bin
161
+ - spec/fixtures/data/2.0.1/filter_range.bin
162
+ - spec/fixtures/data/2.0.1/filter_range_exclude.bin
163
+ - spec/fixtures/data/2.0.1/group.bin
164
+ - spec/fixtures/data/2.0.1/index.bin
165
+ - spec/fixtures/data/2.0.1/index_weights.bin
166
+ - spec/fixtures/data/2.0.1/keywords_with_hits.bin
167
+ - spec/fixtures/data/2.0.1/keywords_without_hits.bin
168
+ - spec/fixtures/data/2.0.1/overrides.bin
169
+ - spec/fixtures/data/2.0.1/phrase.bin
170
+ - spec/fixtures/data/2.0.1/rank_mode.bin
171
+ - spec/fixtures/data/2.0.1/select.bin
172
+ - spec/fixtures/data/2.0.1/simple.bin
173
+ - spec/fixtures/data/2.0.1/sort.bin
174
+ - spec/fixtures/data/2.0.1/update_simple.bin
175
+ - spec/fixtures/data/2.0.1/weights.bin
176
+ - spec/fixtures/data_generator.0.9.8.php
177
+ - spec/fixtures/data_generator.0.9.9.php
178
+ - spec/fixtures/data_generator.1.10.php
179
+ - spec/fixtures/data_generator.2.0.1.php
180
+ - spec/fixtures/data_generator.php
181
+ - spec/fixtures/sphinx/configuration.erb
182
+ - spec/fixtures/sphinxapi.0.9.8.php
183
+ - spec/fixtures/sphinxapi.0.9.9.php
184
+ - spec/fixtures/sphinxapi.1.10.php
185
+ - spec/fixtures/sphinxapi.2.0.1.php
186
+ - spec/fixtures/sql/conf.example.yml
187
+ - spec/fixtures/sql/data.sql
188
+ - spec/fixtures/sql/data.tsv
189
+ - spec/fixtures/sql/structure.sql
101
190
  - spec/functional/connection_spec.rb
102
191
  - spec/functional/excerpt_spec.rb
103
192
  - spec/functional/keywords_spec.rb
@@ -115,7 +204,8 @@ files:
115
204
  - spec/riddle/query_spec.rb
116
205
  - spec/riddle_spec.rb
117
206
  - spec/spec_helper.rb
118
- - spec/sphinx_helper.rb
207
+ - spec/support/binary_fixtures.rb
208
+ - spec/support/sphinx.rb
119
209
  - spec/unit/client_spec.rb
120
210
  - spec/unit/configuration/distributed_index_spec.rb
121
211
  - spec/unit/configuration/index_spec.rb
@@ -130,38 +220,133 @@ files:
130
220
  - spec/unit/message_spec.rb
131
221
  - spec/unit/response_spec.rb
132
222
  - spec/unit/riddle_spec.rb
133
- has_rdoc: true
134
223
  homepage: http://freelancing-god.github.com/riddle/
135
224
  licenses: []
136
-
137
225
  post_install_message:
138
226
  rdoc_options: []
139
-
140
- require_paths:
227
+ require_paths:
141
228
  - lib
142
- required_ruby_version: !ruby/object:Gem::Requirement
229
+ required_ruby_version: !ruby/object:Gem::Requirement
143
230
  none: false
144
- requirements:
145
- - - ">="
146
- - !ruby/object:Gem::Version
147
- hash: 1550771664451883617
148
- segments:
231
+ requirements:
232
+ - - ! '>='
233
+ - !ruby/object:Gem::Version
234
+ version: '0'
235
+ segments:
149
236
  - 0
150
- version: "0"
151
- required_rubygems_version: !ruby/object:Gem::Requirement
237
+ hash: -3403053604125557779
238
+ required_rubygems_version: !ruby/object:Gem::Requirement
152
239
  none: false
153
- requirements:
154
- - - ">="
155
- - !ruby/object:Gem::Version
156
- version: "0"
240
+ requirements:
241
+ - - ! '>='
242
+ - !ruby/object:Gem::Version
243
+ version: '0'
244
+ segments:
245
+ - 0
246
+ hash: -3403053604125557779
157
247
  requirements: []
158
-
159
- rubyforge_project:
160
- rubygems_version: 1.6.2
248
+ rubyforge_project: riddle
249
+ rubygems_version: 1.8.10
161
250
  signing_key:
162
251
  specification_version: 3
163
252
  summary: An API for Sphinx, written in and for Ruby.
164
- test_files:
253
+ test_files:
254
+ - spec/fixtures/.gitignore
255
+ - spec/fixtures/data/0.9.9/anchor.bin
256
+ - spec/fixtures/data/0.9.9/any.bin
257
+ - spec/fixtures/data/0.9.9/boolean.bin
258
+ - spec/fixtures/data/0.9.9/comment.bin
259
+ - spec/fixtures/data/0.9.9/distinct.bin
260
+ - spec/fixtures/data/0.9.9/field_weights.bin
261
+ - spec/fixtures/data/0.9.9/filter.bin
262
+ - spec/fixtures/data/0.9.9/filter_array.bin
263
+ - spec/fixtures/data/0.9.9/filter_array_exclude.bin
264
+ - spec/fixtures/data/0.9.9/filter_boolean.bin
265
+ - spec/fixtures/data/0.9.9/filter_floats.bin
266
+ - spec/fixtures/data/0.9.9/filter_floats_exclude.bin
267
+ - spec/fixtures/data/0.9.9/filter_range.bin
268
+ - spec/fixtures/data/0.9.9/filter_range_exclude.bin
269
+ - spec/fixtures/data/0.9.9/group.bin
270
+ - spec/fixtures/data/0.9.9/index.bin
271
+ - spec/fixtures/data/0.9.9/index_weights.bin
272
+ - spec/fixtures/data/0.9.9/keywords_with_hits.bin
273
+ - spec/fixtures/data/0.9.9/keywords_without_hits.bin
274
+ - spec/fixtures/data/0.9.9/overrides.bin
275
+ - spec/fixtures/data/0.9.9/phrase.bin
276
+ - spec/fixtures/data/0.9.9/rank_mode.bin
277
+ - spec/fixtures/data/0.9.9/select.bin
278
+ - spec/fixtures/data/0.9.9/simple.bin
279
+ - spec/fixtures/data/0.9.9/sort.bin
280
+ - spec/fixtures/data/0.9.9/update_simple.bin
281
+ - spec/fixtures/data/0.9.9/weights.bin
282
+ - spec/fixtures/data/1.10/anchor.bin
283
+ - spec/fixtures/data/1.10/any.bin
284
+ - spec/fixtures/data/1.10/boolean.bin
285
+ - spec/fixtures/data/1.10/comment.bin
286
+ - spec/fixtures/data/1.10/distinct.bin
287
+ - spec/fixtures/data/1.10/field_weights.bin
288
+ - spec/fixtures/data/1.10/filter.bin
289
+ - spec/fixtures/data/1.10/filter_array.bin
290
+ - spec/fixtures/data/1.10/filter_array_exclude.bin
291
+ - spec/fixtures/data/1.10/filter_boolean.bin
292
+ - spec/fixtures/data/1.10/filter_floats.bin
293
+ - spec/fixtures/data/1.10/filter_floats_exclude.bin
294
+ - spec/fixtures/data/1.10/filter_range.bin
295
+ - spec/fixtures/data/1.10/filter_range_exclude.bin
296
+ - spec/fixtures/data/1.10/group.bin
297
+ - spec/fixtures/data/1.10/index.bin
298
+ - spec/fixtures/data/1.10/index_weights.bin
299
+ - spec/fixtures/data/1.10/keywords_with_hits.bin
300
+ - spec/fixtures/data/1.10/keywords_without_hits.bin
301
+ - spec/fixtures/data/1.10/overrides.bin
302
+ - spec/fixtures/data/1.10/phrase.bin
303
+ - spec/fixtures/data/1.10/rank_mode.bin
304
+ - spec/fixtures/data/1.10/select.bin
305
+ - spec/fixtures/data/1.10/simple.bin
306
+ - spec/fixtures/data/1.10/sort.bin
307
+ - spec/fixtures/data/1.10/update_simple.bin
308
+ - spec/fixtures/data/1.10/weights.bin
309
+ - spec/fixtures/data/2.0.1/anchor.bin
310
+ - spec/fixtures/data/2.0.1/any.bin
311
+ - spec/fixtures/data/2.0.1/boolean.bin
312
+ - spec/fixtures/data/2.0.1/comment.bin
313
+ - spec/fixtures/data/2.0.1/distinct.bin
314
+ - spec/fixtures/data/2.0.1/field_weights.bin
315
+ - spec/fixtures/data/2.0.1/filter.bin
316
+ - spec/fixtures/data/2.0.1/filter_array.bin
317
+ - spec/fixtures/data/2.0.1/filter_array_exclude.bin
318
+ - spec/fixtures/data/2.0.1/filter_boolean.bin
319
+ - spec/fixtures/data/2.0.1/filter_floats.bin
320
+ - spec/fixtures/data/2.0.1/filter_floats_exclude.bin
321
+ - spec/fixtures/data/2.0.1/filter_range.bin
322
+ - spec/fixtures/data/2.0.1/filter_range_exclude.bin
323
+ - spec/fixtures/data/2.0.1/group.bin
324
+ - spec/fixtures/data/2.0.1/index.bin
325
+ - spec/fixtures/data/2.0.1/index_weights.bin
326
+ - spec/fixtures/data/2.0.1/keywords_with_hits.bin
327
+ - spec/fixtures/data/2.0.1/keywords_without_hits.bin
328
+ - spec/fixtures/data/2.0.1/overrides.bin
329
+ - spec/fixtures/data/2.0.1/phrase.bin
330
+ - spec/fixtures/data/2.0.1/rank_mode.bin
331
+ - spec/fixtures/data/2.0.1/select.bin
332
+ - spec/fixtures/data/2.0.1/simple.bin
333
+ - spec/fixtures/data/2.0.1/sort.bin
334
+ - spec/fixtures/data/2.0.1/update_simple.bin
335
+ - spec/fixtures/data/2.0.1/weights.bin
336
+ - spec/fixtures/data_generator.0.9.8.php
337
+ - spec/fixtures/data_generator.0.9.9.php
338
+ - spec/fixtures/data_generator.1.10.php
339
+ - spec/fixtures/data_generator.2.0.1.php
340
+ - spec/fixtures/data_generator.php
341
+ - spec/fixtures/sphinx/configuration.erb
342
+ - spec/fixtures/sphinxapi.0.9.8.php
343
+ - spec/fixtures/sphinxapi.0.9.9.php
344
+ - spec/fixtures/sphinxapi.1.10.php
345
+ - spec/fixtures/sphinxapi.2.0.1.php
346
+ - spec/fixtures/sql/conf.example.yml
347
+ - spec/fixtures/sql/data.sql
348
+ - spec/fixtures/sql/data.tsv
349
+ - spec/fixtures/sql/structure.sql
165
350
  - spec/functional/connection_spec.rb
166
351
  - spec/functional/excerpt_spec.rb
167
352
  - spec/functional/keywords_spec.rb
@@ -179,7 +364,8 @@ test_files:
179
364
  - spec/riddle/query_spec.rb
180
365
  - spec/riddle_spec.rb
181
366
  - spec/spec_helper.rb
182
- - spec/sphinx_helper.rb
367
+ - spec/support/binary_fixtures.rb
368
+ - spec/support/sphinx.rb
183
369
  - spec/unit/client_spec.rb
184
370
  - spec/unit/configuration/distributed_index_spec.rb
185
371
  - spec/unit/configuration/index_spec.rb
@@ -1,96 +0,0 @@
1
- require 'erb'
2
- require 'yaml'
3
-
4
- class SphinxHelper
5
- attr_accessor :host, :username, :password
6
- attr_reader :path
7
-
8
- def initialize
9
- @host = "localhost"
10
- @username = "anonymous"
11
- @password = ""
12
-
13
- if File.exist?("spec/fixtures/sql/conf.yml")
14
- config = YAML.load(File.open("spec/fixtures/sql/conf.yml"))
15
- @host = config["host"]
16
- @username = config["username"]
17
- @password = config["password"]
18
- end
19
-
20
- @path = File.expand_path(File.dirname(__FILE__))
21
- end
22
-
23
- def setup_mysql
24
- client = Mysql2::Client.new(
25
- :host => @host,
26
- :username => @username,
27
- :password => @password
28
- )
29
-
30
- databases = client.query('SHOW DATABASES', :as => :array).to_a.flatten
31
- unless databases.include?('riddle')
32
- client.query 'CREATE DATABASE riddle'
33
- end
34
-
35
- client.query "USE riddle"
36
-
37
- structure = File.open("spec/fixtures/sql/structure.sql") { |f| f.read }
38
- structure.split(/;/).each { |sql| client.query sql }
39
- client.query <<-SQL
40
- LOAD DATA INFILE '#{@path}/fixtures/sql/data.tsv' INTO TABLE
41
- `riddle`.`people` FIELDS TERMINATED BY ',' ENCLOSED BY "'" (gender,
42
- first_name, middle_initial, last_name, street_address, city, state,
43
- postcode, email, birthday)
44
- SQL
45
-
46
- client.close
47
- end
48
-
49
- def reset
50
- setup_mysql
51
- index
52
- end
53
-
54
- def generate_configuration
55
- template = File.open("spec/fixtures/sphinx/configuration.erb") { |f| f.read }
56
- File.open("spec/fixtures/sphinx/spec.conf", "w") { |f|
57
- f.puts ERB.new(template).result(binding)
58
- }
59
- end
60
-
61
- def index
62
- cmd = "indexer --config #{@path}/fixtures/sphinx/spec.conf --all"
63
- cmd << " --rotate" if running?
64
- `#{cmd}`
65
- end
66
-
67
- def start
68
- return if running?
69
-
70
- cmd = "searchd --config #{@path}/fixtures/sphinx/spec.conf"
71
- `#{cmd}`
72
-
73
- sleep(1)
74
-
75
- unless running?
76
- puts "Failed to start searchd daemon. Check fixtures/sphinx/searchd.log."
77
- end
78
- end
79
-
80
- def stop
81
- return unless running?
82
- `kill #{pid}`
83
- end
84
-
85
- def pid
86
- if File.exists?("#{@path}/fixtures/sphinx/searchd.pid")
87
- `cat #{@path}/fixtures/sphinx/searchd.pid`[/\d+/]
88
- else
89
- nil
90
- end
91
- end
92
-
93
- def running?
94
- pid && `ps #{pid} | wc -l`.to_i > 1
95
- end
96
- end