riddle 2.1.0 → 2.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +8 -5
- data/Gemfile +10 -0
- data/HISTORY +4 -0
- data/README.markdown +1 -1
- data/lib/riddle.rb +1 -0
- data/lib/riddle/0.9.9/configuration/searchd.rb +1 -1
- data/lib/riddle/client.rb +4 -1
- data/lib/riddle/client/message.rb +15 -14
- data/lib/riddle/configuration/parser.rb +1 -0
- data/lib/riddle/configuration/section.rb +9 -9
- data/lib/riddle/configuration/source.rb +5 -5
- data/lib/riddle/query/select.rb +3 -2
- data/riddle.gemspec +2 -4
- metadata +4 -329
- data/spec/fixtures/.gitignore +0 -2
- 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/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.0.9.8.php +0 -208
- data/spec/fixtures/data_generator.0.9.9.php +0 -5
- data/spec/fixtures/data_generator.1.10.php +0 -5
- data/spec/fixtures/data_generator.2.0.1.php +0 -5
- data/spec/fixtures/data_generator.2.1.0.php +0 -5
- data/spec/fixtures/data_generator.php +0 -223
- data/spec/fixtures/sphinxapi.0.9.8.php +0 -1228
- data/spec/fixtures/sphinxapi.0.9.9.php +0 -1646
- data/spec/fixtures/sphinxapi.1.10.php +0 -1728
- data/spec/fixtures/sphinxapi.2.0.1.php +0 -1731
- data/spec/fixtures/sphinxapi.2.1.0.php +0 -1752
- data/spec/fixtures/sql/conf.example.yml +0 -3
- data/spec/fixtures/sql/data.sql +0 -25000
- data/spec/fixtures/sql/data.tsv +0 -25000
- data/spec/fixtures/sql/structure.sql +0 -16
- data/spec/functional/connection_spec.rb +0 -64
- data/spec/functional/escaping_spec.rb +0 -49
- data/spec/functional/excerpt_spec.rb +0 -139
- data/spec/functional/keywords_spec.rb +0 -40
- data/spec/functional/persistance_spec.rb +0 -17
- data/spec/functional/search_spec.rb +0 -67
- data/spec/functional/status_spec.rb +0 -21
- data/spec/functional/update_spec.rb +0 -41
- data/spec/riddle/auto_version_spec.rb +0 -95
- data/spec/riddle/client_spec.rb +0 -11
- data/spec/riddle/configuration_spec.rb +0 -28
- data/spec/riddle/controller_spec.rb +0 -39
- data/spec/riddle/query/delete_spec.rb +0 -18
- data/spec/riddle/query/insert_spec.rb +0 -25
- data/spec/riddle/query/select_spec.rb +0 -226
- data/spec/riddle/query_spec.rb +0 -97
- data/spec/riddle_spec.rb +0 -27
- data/spec/spec_helper.rb +0 -34
- data/spec/support/binary_fixtures.rb +0 -18
- data/spec/support/sphinx.rb +0 -137
- data/spec/unit/client_spec.rb +0 -290
- data/spec/unit/configuration/common_spec.rb +0 -60
- data/spec/unit/configuration/distributed_index_spec.rb +0 -58
- data/spec/unit/configuration/index_spec.rb +0 -124
- data/spec/unit/configuration/indexer_spec.rb +0 -73
- data/spec/unit/configuration/realtime_index_spec.rb +0 -65
- data/spec/unit/configuration/searchd_spec.rb +0 -228
- data/spec/unit/configuration/source_spec.rb +0 -5
- data/spec/unit/configuration/sql_source_spec.rb +0 -137
- data/spec/unit/configuration/template_index_spec.rb +0 -91
- data/spec/unit/configuration/tsv_source_spec.rb +0 -53
- data/spec/unit/configuration/xml_source_spec.rb +0 -51
- data/spec/unit/configuration_spec.rb +0 -25
- data/spec/unit/filter_spec.rb +0 -38
- data/spec/unit/message_spec.rb +0 -94
- data/spec/unit/response_spec.rb +0 -64
- data/spec/unit/riddle_spec.rb +0 -17
data/spec/unit/response_spec.rb
DELETED
@@ -1,64 +0,0 @@
|
|
1
|
-
require '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').unpack('L*').pack('N')).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].pack('f').unpack('L*').pack('N') + [3, 2, 2, 2].pack('NNNN')
|
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
|
data/spec/unit/riddle_spec.rb
DELETED
@@ -1,17 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe "Riddle" do
|
4
|
-
it "should escape characters correctly" do
|
5
|
-
invalid_chars = ['(', ')', '|', '-', '!', '@', '~', '"', '/']
|
6
|
-
invalid_chars.each do |char|
|
7
|
-
base = "string with '#{char}' character"
|
8
|
-
Riddle.escape(base).should == base.gsub(char, "\\#{char}")
|
9
|
-
end
|
10
|
-
|
11
|
-
# Not sure why this doesn't work within the loop...
|
12
|
-
Riddle.escape("string with & character").should == "string with \\& character"
|
13
|
-
|
14
|
-
all_chars = invalid_chars.join('') + '&'
|
15
|
-
Riddle.escape(all_chars).should == "\\(\\)\\|\\-\\!\\@\\~\\\"\\/\\&"
|
16
|
-
end
|
17
|
-
end
|