ultrasphinx 1.6 → 1.6.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (68) hide show
  1. data.tar.gz.sig +0 -0
  2. data/CHANGELOG +5 -1
  3. data/Manifest +47 -7
  4. data/README +4 -4
  5. data/TODO +1 -0
  6. data/examples/default.base +6 -2
  7. data/lib/ultrasphinx.rb +1 -1
  8. data/lib/ultrasphinx/configure.rb +53 -28
  9. data/lib/ultrasphinx/fields.rb +16 -13
  10. data/lib/ultrasphinx/postgresql/concat_ws.sql +35 -0
  11. data/lib/ultrasphinx/postgresql/crc32.sql +7 -0
  12. data/lib/ultrasphinx/postgresql/group_concat.sql +25 -0
  13. data/lib/ultrasphinx/{hex_to_int.sql → postgresql/hex_to_int.sql} +0 -0
  14. data/lib/ultrasphinx/postgresql/language.sql +1 -0
  15. data/lib/ultrasphinx/postgresql/unix_timestamp.sql +12 -0
  16. data/lib/ultrasphinx/search/internals.rb +42 -16
  17. data/lib/ultrasphinx/ultrasphinx.rb +23 -12
  18. data/test/integration/app/app/models/person/user.rb +1 -1
  19. data/test/integration/app/config/database.yml +9 -13
  20. data/test/integration/app/config/ultrasphinx/development.conf +6 -6
  21. data/test/integration/app/config/ultrasphinx/development.conf.canonical +6 -6
  22. data/test/integration/app/db/schema.rb +9 -2
  23. data/test/integration/search_test.rb +16 -6
  24. data/test/setup.rb +5 -1
  25. data/test/ts.multi +2 -0
  26. data/ultrasphinx.gemspec +5 -5
  27. data/vendor/riddle/{MIT-LICENSE → MIT-LICENCE} +0 -0
  28. data/vendor/riddle/README +60 -0
  29. data/vendor/riddle/Rakefile +25 -0
  30. data/vendor/riddle/{riddle.rb → lib/riddle.rb} +3 -0
  31. data/vendor/riddle/{riddle → lib/riddle}/client.rb +73 -4
  32. data/vendor/riddle/{riddle → lib/riddle}/client/filter.rb +0 -0
  33. data/vendor/riddle/{riddle → lib/riddle}/client/message.rb +2 -0
  34. data/vendor/riddle/{riddle → lib/riddle}/client/response.rb +0 -0
  35. data/vendor/riddle/spec/fixtures/data/anchor.bin +0 -0
  36. data/vendor/riddle/spec/fixtures/data/any.bin +0 -0
  37. data/vendor/riddle/spec/fixtures/data/boolean.bin +0 -0
  38. data/vendor/riddle/spec/fixtures/data/distinct.bin +0 -0
  39. data/vendor/riddle/spec/fixtures/data/filter.bin +0 -0
  40. data/vendor/riddle/spec/fixtures/data/filter_array.bin +0 -0
  41. data/vendor/riddle/spec/fixtures/data/filter_array_exclude.bin +0 -0
  42. data/vendor/riddle/spec/fixtures/data/filter_floats.bin +0 -0
  43. data/vendor/riddle/spec/fixtures/data/filter_floats_exclude.bin +0 -0
  44. data/vendor/riddle/spec/fixtures/data/filter_floats_range.bin +0 -0
  45. data/vendor/riddle/spec/fixtures/data/filter_range.bin +0 -0
  46. data/vendor/riddle/spec/fixtures/data/filter_range_exclude.bin +0 -0
  47. data/vendor/riddle/spec/fixtures/data/group.bin +0 -0
  48. data/vendor/riddle/spec/fixtures/data/index.bin +0 -0
  49. data/vendor/riddle/spec/fixtures/data/phrase.bin +0 -0
  50. data/vendor/riddle/spec/fixtures/data/simple.bin +0 -0
  51. data/vendor/riddle/spec/fixtures/data/sort.bin +0 -0
  52. data/vendor/riddle/spec/fixtures/data/update_simple.bin +0 -0
  53. data/vendor/riddle/spec/fixtures/data/weights.bin +0 -0
  54. data/vendor/riddle/spec/fixtures/sphinx/configuration.erb +38 -0
  55. data/vendor/riddle/spec/fixtures/sql/conf.example.yml +3 -0
  56. data/vendor/riddle/spec/fixtures/sql/data.sql +25000 -0
  57. data/vendor/riddle/spec/fixtures/sql/structure.sql +16 -0
  58. data/vendor/riddle/spec/functional/excerpt_spec.rb +102 -0
  59. data/vendor/riddle/spec/functional/search_spec.rb +69 -0
  60. data/vendor/riddle/spec/functional/update_spec.rb +41 -0
  61. data/vendor/riddle/spec/spec_helper.rb +25 -0
  62. data/vendor/riddle/spec/sphinx_helper.rb +91 -0
  63. data/vendor/riddle/spec/unit/client_spec.rb +140 -0
  64. data/vendor/riddle/spec/unit/filter_spec.rb +33 -0
  65. data/vendor/riddle/spec/unit/message_spec.rb +63 -0
  66. data/vendor/riddle/spec/unit/response_spec.rb +64 -0
  67. metadata +95 -55
  68. metadata.gz.sig +0 -0
@@ -0,0 +1,33 @@
1
+ require 'spec/spec_helper'
2
+
3
+ describe Riddle::Client::Filter do
4
+ it "should render a filter that uses an array of ints correctly" do
5
+ filter = Riddle::Client::Filter.new("field", [1, 2, 3])
6
+ filter.query_message.should == query_contents(:filter_array)
7
+ end
8
+
9
+ it "should render a filter that has exclude set correctly" do
10
+ filter = Riddle::Client::Filter.new("field", [1, 2, 3], true)
11
+ filter.query_message.should == query_contents(:filter_array_exclude)
12
+ end
13
+
14
+ it "should render a filter that is a range of ints correctly" do
15
+ filter = Riddle::Client::Filter.new("field", 1..3)
16
+ filter.query_message.should == query_contents(:filter_range)
17
+ end
18
+
19
+ it "should render a filter that is a range of ints as exclude correctly" do
20
+ filter = Riddle::Client::Filter.new("field", 1..3, true)
21
+ filter.query_message.should == query_contents(:filter_range_exclude)
22
+ end
23
+
24
+ it "should render a filter that is a range of floats correctly" do
25
+ filter = Riddle::Client::Filter.new("field", 5.4..13.5)
26
+ filter.query_message.should == query_contents(:filter_floats)
27
+ end
28
+
29
+ it "should render a filter that is a range of floats as exclude correctly" do
30
+ filter = Riddle::Client::Filter.new("field", 5.4..13.5, true)
31
+ filter.query_message.should == query_contents(:filter_floats_exclude)
32
+ end
33
+ end
@@ -0,0 +1,63 @@
1
+ require 'spec/spec_helper'
2
+
3
+ describe Riddle::Client::Message do
4
+ it "should start with an empty string" do
5
+ Riddle::Client::Message.new.to_s.should == ""
6
+ end
7
+
8
+ it "should append raw data correctly" do
9
+ data = [1, 2, 3].pack('NNN')
10
+ message = Riddle::Client::Message.new
11
+ message.append data
12
+ message.to_s.should == data
13
+ end
14
+
15
+ it "should append strings correctly - with length first" do
16
+ str = "something to test with"
17
+ message = Riddle::Client::Message.new
18
+ message.append_string str
19
+ message.to_s.should == [str.length].pack('N') + str
20
+ end
21
+
22
+ it "should append integers correctly - packed with N" do
23
+ message = Riddle::Client::Message.new
24
+ message.append_int 234
25
+ message.to_s.should == [234].pack('N')
26
+ end
27
+
28
+ it "should append floats correctly - packed with f" do
29
+ message = Riddle::Client::Message.new
30
+ message.append_float 1.4
31
+ message.to_s.should == [1.4].pack('f')
32
+ end
33
+
34
+ it "should append a collection of integers correctly" do
35
+ message = Riddle::Client::Message.new
36
+ message.append_ints 1, 2, 3, 4
37
+ message.to_s.should == [1, 2, 3, 4].pack('NNNN')
38
+ end
39
+
40
+ it "should append a collection of floats correctly" do
41
+ message = Riddle::Client::Message.new
42
+ message.append_floats 1.0, 1.1, 1.2, 1.3
43
+ message.to_s.should == [1.0, 1.1, 1.2, 1.3].pack('ffff')
44
+ end
45
+
46
+ it "should append an array of strings correctly" do
47
+ arr = ["a", "bb", "ccc"]
48
+ message = Riddle::Client::Message.new
49
+ message.append_array arr
50
+ message.to_s.should == [3, 1].pack('NN') + "a" + [2].pack('N') + "bb" +
51
+ [3].pack('N') + "ccc"
52
+ end
53
+
54
+ it "should append a variety of objects correctly" do
55
+ message = Riddle::Client::Message.new
56
+ message.append_int 4
57
+ message.append_string "test"
58
+ message.append_array ["one", "two"]
59
+ message.append_floats 1.5, 1.7
60
+ message.to_s.should == [4, 4].pack('NN') + "test" + [2, 3].pack('NN') +
61
+ "one" + [3].pack('N') + "two" + [1.5, 1.7].pack('ff')
62
+ end
63
+ end
@@ -0,0 +1,64 @@
1
+ require 'spec/spec_helper'
2
+
3
+ describe Riddle::Client::Response do
4
+ it "should interpret an integer correctly" do
5
+ Riddle::Client::Response.new([42].pack('N')).next_int.should == 42
6
+ end
7
+
8
+ it "should interpret a string correctly" do
9
+ str = "this is a string"
10
+ Riddle::Client::Response.new(
11
+ [str.length].pack('N') + str
12
+ ).next.should == str
13
+ end
14
+
15
+ # Comparing floats with decimal places doesn't seem to be exact
16
+ it "should interpret a float correctly" do
17
+ Riddle::Client::Response.new([1.0].pack('f')).next_float.should == 1.0
18
+ end
19
+
20
+ it "should interpret an array of strings correctly" do
21
+ arr = ["a", "b", "c", "d"]
22
+ Riddle::Client::Response.new(
23
+ [arr.length].pack('N') + arr.collect { |str|
24
+ [str.length].pack('N') + str
25
+ }.join("")
26
+ ).next_array.should == arr
27
+ end
28
+
29
+ it "should interpret an array of ints correctly" do
30
+ arr = [1, 2, 3, 4]
31
+ Riddle::Client::Response.new(
32
+ [arr.length].pack('N') + arr.collect { |int|
33
+ [int].pack('N')
34
+ }.join("")
35
+ ).next_int_array.should == arr
36
+ end
37
+
38
+ it "should reflect the length of the incoming data correctly" do
39
+ data = [1, 2, 3, 4].pack('NNNN')
40
+ Riddle::Client::Response.new(data).length.should == data.length
41
+ end
42
+
43
+ it "should handle a combination of strings and ints correctly" do
44
+ data = [1, 3, 5, 1].pack('NNNN') + 'a' + [2, 4].pack('NN') + 'test'
45
+ response = Riddle::Client::Response.new(data)
46
+ response.next_int.should == 1
47
+ response.next_int.should == 3
48
+ response.next_int.should == 5
49
+ response.next.should == 'a'
50
+ response.next_int.should == 2
51
+ response.next.should == 'test'
52
+ end
53
+
54
+ it "should handle a combination of strings, ints, floats and string arrays correctly" do
55
+ data = [1, 2, 2].pack('NNN') + 'aa' + [2].pack('N') + 'bb' + [4].pack('N') +
56
+ "word" + [7, 3, 2, 2, 2].pack('fNNNN')
57
+ response = Riddle::Client::Response.new(data)
58
+ response.next_int.should == 1
59
+ response.next_array.should == ['aa', 'bb']
60
+ response.next.should == "word"
61
+ response.next_float.should == 7
62
+ response.next_int_array.should == [2, 2, 2]
63
+ end
64
+ end
metadata CHANGED
@@ -1,35 +1,12 @@
1
1
  --- !ruby/object:Gem::Specification
2
- rubygems_version: 0.9.4.6
3
- specification_version: 2
4
2
  name: ultrasphinx
5
3
  version: !ruby/object:Gem::Version
6
- version: "1.6"
7
- date: 2007-11-14 00:00:00 -05:00
8
- summary: Ruby on Rails configurator and client to the Sphinx fulltext search engine.
9
- require_paths:
10
- - lib
11
- email: ""
12
- homepage: http://blog.evanweaver.com/files/doc/fauna/ultrasphinx/
13
- rubyforge_project: fauna
14
- description: Ruby on Rails configurator and client to the Sphinx fulltext search engine.
4
+ version: 1.6.7
5
+ platform: ruby
6
+ authors:
7
+ - ""
15
8
  autorequire:
16
- default_executable:
17
9
  bindir: bin
18
- has_rdoc: true
19
- required_ruby_version: !ruby/object:Gem::Requirement
20
- requirements:
21
- - - ">="
22
- - !ruby/object:Gem::Version
23
- version: "0"
24
- version:
25
- required_rubygems_version: !ruby/object:Gem::Requirement
26
- requirements:
27
- - - ">="
28
- - !ruby/object:Gem::Version
29
- version: "0"
30
- version:
31
- platform: ruby
32
- signing_key:
33
10
  cert_chain:
34
11
  - |
35
12
  -----BEGIN CERTIFICATE-----
@@ -53,9 +30,26 @@ cert_chain:
53
30
  yZ0=
54
31
  -----END CERTIFICATE-----
55
32
 
56
- post_install_message:
57
- authors:
58
- - ""
33
+ date: 2007-12-13 00:00:00 -05:00
34
+ default_executable:
35
+ dependencies:
36
+ - !ruby/object:Gem::Dependency
37
+ name: chronic
38
+ version_requirement:
39
+ version_requirements: !ruby/object:Gem::Requirement
40
+ requirements:
41
+ - - ">="
42
+ - !ruby/object:Gem::Version
43
+ version: "0"
44
+ version:
45
+ description: Ruby on Rails configurator and client to the Sphinx fulltext search engine.
46
+ email: ""
47
+ executables: []
48
+
49
+ extensions: []
50
+
51
+ extra_rdoc_files: []
52
+
59
53
  files:
60
54
  - CHANGELOG
61
55
  - examples/ap.multi
@@ -65,8 +59,13 @@ files:
65
59
  - lib/ultrasphinx/configure.rb
66
60
  - lib/ultrasphinx/core_extensions.rb
67
61
  - lib/ultrasphinx/fields.rb
68
- - lib/ultrasphinx/hex_to_int.sql
69
62
  - lib/ultrasphinx/is_indexed.rb
63
+ - lib/ultrasphinx/postgresql/concat_ws.sql
64
+ - lib/ultrasphinx/postgresql/crc32.sql
65
+ - lib/ultrasphinx/postgresql/group_concat.sql
66
+ - lib/ultrasphinx/postgresql/hex_to_int.sql
67
+ - lib/ultrasphinx/postgresql/language.sql
68
+ - lib/ultrasphinx/postgresql/unix_timestamp.sql
70
69
  - lib/ultrasphinx/search/internals.rb
71
70
  - lib/ultrasphinx/search/parser.rb
72
71
  - lib/ultrasphinx/search.rb
@@ -183,35 +182,76 @@ files:
183
182
  - test/setup.rb
184
183
  - test/test_all.rb
185
184
  - test/test_helper.rb
185
+ - test/ts.multi
186
186
  - test/unit/parser_test.rb
187
187
  - TODO
188
- - vendor/riddle/MIT-LICENSE
189
- - vendor/riddle/riddle/client/filter.rb
190
- - vendor/riddle/riddle/client/message.rb
191
- - vendor/riddle/riddle/client/response.rb
192
- - vendor/riddle/riddle/client.rb
193
- - vendor/riddle/riddle.rb
188
+ - vendor/riddle/lib/riddle/client/filter.rb
189
+ - vendor/riddle/lib/riddle/client/message.rb
190
+ - vendor/riddle/lib/riddle/client/response.rb
191
+ - vendor/riddle/lib/riddle/client.rb
192
+ - vendor/riddle/lib/riddle.rb
193
+ - vendor/riddle/MIT-LICENCE
194
+ - vendor/riddle/Rakefile
195
+ - vendor/riddle/README
196
+ - vendor/riddle/spec/fixtures/data/anchor.bin
197
+ - vendor/riddle/spec/fixtures/data/any.bin
198
+ - vendor/riddle/spec/fixtures/data/boolean.bin
199
+ - vendor/riddle/spec/fixtures/data/distinct.bin
200
+ - vendor/riddle/spec/fixtures/data/filter.bin
201
+ - vendor/riddle/spec/fixtures/data/filter_array.bin
202
+ - vendor/riddle/spec/fixtures/data/filter_array_exclude.bin
203
+ - vendor/riddle/spec/fixtures/data/filter_floats.bin
204
+ - vendor/riddle/spec/fixtures/data/filter_floats_exclude.bin
205
+ - vendor/riddle/spec/fixtures/data/filter_floats_range.bin
206
+ - vendor/riddle/spec/fixtures/data/filter_range.bin
207
+ - vendor/riddle/spec/fixtures/data/filter_range_exclude.bin
208
+ - vendor/riddle/spec/fixtures/data/group.bin
209
+ - vendor/riddle/spec/fixtures/data/index.bin
210
+ - vendor/riddle/spec/fixtures/data/phrase.bin
211
+ - vendor/riddle/spec/fixtures/data/simple.bin
212
+ - vendor/riddle/spec/fixtures/data/sort.bin
213
+ - vendor/riddle/spec/fixtures/data/update_simple.bin
214
+ - vendor/riddle/spec/fixtures/data/weights.bin
215
+ - vendor/riddle/spec/fixtures/sphinx/configuration.erb
216
+ - vendor/riddle/spec/fixtures/sql/conf.example.yml
217
+ - vendor/riddle/spec/fixtures/sql/data.sql
218
+ - vendor/riddle/spec/fixtures/sql/structure.sql
219
+ - vendor/riddle/spec/functional/excerpt_spec.rb
220
+ - vendor/riddle/spec/functional/search_spec.rb
221
+ - vendor/riddle/spec/functional/update_spec.rb
222
+ - vendor/riddle/spec/spec_helper.rb
223
+ - vendor/riddle/spec/sphinx_helper.rb
224
+ - vendor/riddle/spec/unit/client_spec.rb
225
+ - vendor/riddle/spec/unit/filter_spec.rb
226
+ - vendor/riddle/spec/unit/message_spec.rb
227
+ - vendor/riddle/spec/unit/response_spec.rb
194
228
  - vendor/will_paginate/LICENSE
195
229
  - ultrasphinx.gemspec
196
- test_files:
197
- - test/test_all.rb
230
+ has_rdoc: true
231
+ homepage: http://blog.evanweaver.com/files/doc/fauna/ultrasphinx/
232
+ post_install_message:
198
233
  rdoc_options: []
199
234
 
200
- extra_rdoc_files: []
201
-
202
- executables: []
203
-
204
- extensions: []
205
-
235
+ require_paths:
236
+ - lib
237
+ required_ruby_version: !ruby/object:Gem::Requirement
238
+ requirements:
239
+ - - ">="
240
+ - !ruby/object:Gem::Version
241
+ version: "0"
242
+ version:
243
+ required_rubygems_version: !ruby/object:Gem::Requirement
244
+ requirements:
245
+ - - ">="
246
+ - !ruby/object:Gem::Version
247
+ version: "0"
248
+ version:
206
249
  requirements: []
207
250
 
208
- dependencies:
209
- - !ruby/object:Gem::Dependency
210
- name: chronic
211
- version_requirement:
212
- version_requirements: !ruby/object:Gem::Requirement
213
- requirements:
214
- - - ">="
215
- - !ruby/object:Gem::Version
216
- version: "0"
217
- version:
251
+ rubyforge_project: fauna
252
+ rubygems_version: 0.9.5
253
+ signing_key:
254
+ specification_version: 2
255
+ summary: Ruby on Rails configurator and client to the Sphinx fulltext search engine.
256
+ test_files:
257
+ - test/test_all.rb
metadata.gz.sig CHANGED
Binary file