riddle 0.9.8.1198 → 0.9.8.1198.1
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.
- data/lib/riddle.rb +8 -5
- data/lib/riddle/client.rb +14 -8
- data/lib/riddle/client/response.rb +10 -0
- metadata +2 -2
data/lib/riddle.rb
CHANGED
@@ -9,14 +9,17 @@ module Riddle #:nodoc:
|
|
9
9
|
end
|
10
10
|
|
11
11
|
module Version #:nodoc:
|
12
|
-
Major
|
13
|
-
Minor
|
14
|
-
Tiny
|
12
|
+
Major = 0
|
13
|
+
Minor = 9
|
14
|
+
Tiny = 8
|
15
15
|
# Revision number for RubyForge's sake, taken from what Sphinx
|
16
16
|
# outputs to the command line.
|
17
|
-
Rev
|
17
|
+
Rev = 1198
|
18
|
+
# Release number to mark my own fixes, beyond feature parity with
|
19
|
+
# Sphinx itself.
|
20
|
+
Release = 1
|
18
21
|
|
19
22
|
String = [Major, Minor, Tiny].join('.') + "rc1"
|
20
|
-
GemVersion = [Major, Minor, Tiny, Rev].join('.')
|
23
|
+
GemVersion = [Major, Minor, Tiny, Rev, Release].join('.')
|
21
24
|
end
|
22
25
|
end
|
data/lib/riddle/client.rb
CHANGED
@@ -206,14 +206,9 @@ module Riddle
|
|
206
206
|
|
207
207
|
result[:matches] << {:doc => doc, :weight => weight, :index => i, :attributes => {}}
|
208
208
|
result[:attribute_names].each do |attr|
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
when AttributeTypes[:multi]
|
213
|
-
result[:matches].last[:attributes][attr] = response.next_int_array
|
214
|
-
else
|
215
|
-
result[:matches].last[:attributes][attr] = response.next_int
|
216
|
-
end
|
209
|
+
result[:matches].last[:attributes][attr] = attribute_from_type(
|
210
|
+
result[:attributes][attr], response
|
211
|
+
)
|
217
212
|
end
|
218
213
|
end
|
219
214
|
|
@@ -583,5 +578,16 @@ module Riddle
|
|
583
578
|
|
584
579
|
message.to_s
|
585
580
|
end
|
581
|
+
|
582
|
+
def attribute_from_type(type, response)
|
583
|
+
type -= AttributeTypes[:multi] if is_multi = type > AttributeTypes[:multi]
|
584
|
+
|
585
|
+
case type
|
586
|
+
when AttributeTypes[:float]
|
587
|
+
is_multi ? response.next_float_array : response.next_float
|
588
|
+
else
|
589
|
+
is_multi ? response.next_int_array : response.next_int
|
590
|
+
end
|
591
|
+
end
|
586
592
|
end
|
587
593
|
end
|
@@ -65,6 +65,16 @@ module Riddle
|
|
65
65
|
return items
|
66
66
|
end
|
67
67
|
|
68
|
+
def next_float_array
|
69
|
+
count = next_int
|
70
|
+
items = []
|
71
|
+
for i in 0...count
|
72
|
+
items << self.next_float
|
73
|
+
end
|
74
|
+
|
75
|
+
return items
|
76
|
+
end
|
77
|
+
|
68
78
|
# Returns the length of the streamed data
|
69
79
|
def length
|
70
80
|
@str.length
|
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: 0.9.8.1198
|
4
|
+
version: 0.9.8.1198.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Pat Allan
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2008-03-
|
12
|
+
date: 2008-03-22 00:00:00 +11:00
|
13
13
|
default_executable:
|
14
14
|
dependencies: []
|
15
15
|
|