picky 3.4.2 → 3.4.3
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/picky/bundle_indexing.rb +12 -1
- data/spec/lib/indexing/bundle_spec.rb +22 -5
- metadata +26 -26
@@ -103,14 +103,25 @@ module Picky
|
|
103
103
|
#
|
104
104
|
# TODO Move this out to the category?
|
105
105
|
#
|
106
|
+
# Note: The clean way to do this would be to
|
107
|
+
# self.inverted.values.each &:uniq!
|
108
|
+
#
|
109
|
+
# Note 2:
|
110
|
+
# initialize_inverted_index_for token
|
111
|
+
# id = id.send(format)
|
112
|
+
# next if last_id == id
|
113
|
+
# self.inverted[token] << id
|
114
|
+
# last_id = id
|
115
|
+
#
|
106
116
|
def retrieve
|
107
117
|
format = key_format || :to_i
|
108
118
|
empty_inverted
|
119
|
+
id, last_id = nil, nil
|
109
120
|
prepared.retrieve do |id, token|
|
110
121
|
initialize_inverted_index_for token
|
111
122
|
self.inverted[token] << id.send(format)
|
112
|
-
self.inverted[token].uniq!
|
113
123
|
end
|
124
|
+
self.inverted.values.each &:uniq!
|
114
125
|
end
|
115
126
|
|
116
127
|
# Generate a partial index from the given exact inverted index.
|
@@ -80,11 +80,19 @@ describe Picky::Bundle do
|
|
80
80
|
|
81
81
|
describe 'retrieve' do
|
82
82
|
before(:each) do
|
83
|
+
@ary = []
|
84
|
+
|
83
85
|
prepared = stub :prepared
|
84
|
-
prepared.should_receive(:retrieve).once.and_yield '
|
86
|
+
prepared.should_receive(:retrieve).once.and_yield(' 1', :some_token)
|
87
|
+
.and_yield('1 ', :some_token)
|
88
|
+
.and_yield('1', :some_token)
|
89
|
+
.and_yield(' 2', :some_token)
|
90
|
+
.and_yield('3', :some_token)
|
91
|
+
.and_yield(' 3 ', :some_token)
|
92
|
+
.and_yield(' 1234', :some_token)
|
93
|
+
|
85
94
|
bundle.stub! :prepared => prepared
|
86
95
|
|
87
|
-
@ary = [1,1,1,2,3,3]
|
88
96
|
@inverted = stub :inverted, :[] => @ary
|
89
97
|
bundle.stub! :inverted => @inverted
|
90
98
|
end
|
@@ -104,7 +112,10 @@ describe Picky::Bundle do
|
|
104
112
|
@category.stub! :key_format => :to_i
|
105
113
|
end
|
106
114
|
it 'should call the other methods correctly' do
|
107
|
-
@ary.should_receive(:<<).once.with
|
115
|
+
@ary.should_receive(:<<).once.ordered.with 1
|
116
|
+
@ary.should_receive(:<<).once.ordered.with 2
|
117
|
+
@ary.should_receive(:<<).once.ordered.with 3
|
118
|
+
@ary.should_receive(:<<).once.ordered.with 1234
|
108
119
|
|
109
120
|
bundle.retrieve
|
110
121
|
end
|
@@ -114,7 +125,10 @@ describe Picky::Bundle do
|
|
114
125
|
@category.stub! :key_format => :strip
|
115
126
|
end
|
116
127
|
it 'should call the other methods correctly' do
|
117
|
-
@ary.should_receive(:<<).once.with '
|
128
|
+
@ary.should_receive(:<<).once.ordered.with '1'
|
129
|
+
@ary.should_receive(:<<).once.ordered.with '2'
|
130
|
+
@ary.should_receive(:<<).once.ordered.with '3'
|
131
|
+
@ary.should_receive(:<<).once.ordered.with '1234'
|
118
132
|
|
119
133
|
bundle.retrieve
|
120
134
|
end
|
@@ -124,7 +138,10 @@ describe Picky::Bundle do
|
|
124
138
|
@category.stub! :key_format => nil
|
125
139
|
end
|
126
140
|
it 'should call the other methods correctly' do
|
127
|
-
@ary.should_receive(:<<).once.with
|
141
|
+
@ary.should_receive(:<<).once.ordered.with 1
|
142
|
+
@ary.should_receive(:<<).once.ordered.with 2
|
143
|
+
@ary.should_receive(:<<).once.ordered.with 3
|
144
|
+
@ary.should_receive(:<<).once.ordered.with 1234
|
128
145
|
|
129
146
|
bundle.retrieve
|
130
147
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: picky
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.4.
|
4
|
+
version: 3.4.3
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -13,7 +13,7 @@ date: 2011-11-10 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rspec
|
16
|
-
requirement: &
|
16
|
+
requirement: &70203421661040 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,21 +21,21 @@ dependencies:
|
|
21
21
|
version: '0'
|
22
22
|
type: :development
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *70203421661040
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: picky-client
|
27
|
-
requirement: &
|
27
|
+
requirement: &70203421658600 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ~>
|
31
31
|
- !ruby/object:Gem::Version
|
32
|
-
version: 3.4.
|
32
|
+
version: 3.4.3
|
33
33
|
type: :development
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *70203421658600
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: rack
|
38
|
-
requirement: &
|
38
|
+
requirement: &70203421656060 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ! '>='
|
@@ -43,10 +43,10 @@ dependencies:
|
|
43
43
|
version: '0'
|
44
44
|
type: :runtime
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *70203421656060
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: rack_fast_escape
|
49
|
-
requirement: &
|
49
|
+
requirement: &70203421653860 !ruby/object:Gem::Requirement
|
50
50
|
none: false
|
51
51
|
requirements:
|
52
52
|
- - ! '>='
|
@@ -54,10 +54,10 @@ dependencies:
|
|
54
54
|
version: '0'
|
55
55
|
type: :runtime
|
56
56
|
prerelease: false
|
57
|
-
version_requirements: *
|
57
|
+
version_requirements: *70203421653860
|
58
58
|
- !ruby/object:Gem::Dependency
|
59
59
|
name: text
|
60
|
-
requirement: &
|
60
|
+
requirement: &70203421652480 !ruby/object:Gem::Requirement
|
61
61
|
none: false
|
62
62
|
requirements:
|
63
63
|
- - ! '>='
|
@@ -65,10 +65,10 @@ dependencies:
|
|
65
65
|
version: '0'
|
66
66
|
type: :runtime
|
67
67
|
prerelease: false
|
68
|
-
version_requirements: *
|
68
|
+
version_requirements: *70203421652480
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: yajl-ruby
|
71
|
-
requirement: &
|
71
|
+
requirement: &70203421649180 !ruby/object:Gem::Requirement
|
72
72
|
none: false
|
73
73
|
requirements:
|
74
74
|
- - ! '>='
|
@@ -76,10 +76,10 @@ dependencies:
|
|
76
76
|
version: '0'
|
77
77
|
type: :runtime
|
78
78
|
prerelease: false
|
79
|
-
version_requirements: *
|
79
|
+
version_requirements: *70203421649180
|
80
80
|
- !ruby/object:Gem::Dependency
|
81
81
|
name: activesupport
|
82
|
-
requirement: &
|
82
|
+
requirement: &70203421644700 !ruby/object:Gem::Requirement
|
83
83
|
none: false
|
84
84
|
requirements:
|
85
85
|
- - ~>
|
@@ -87,10 +87,10 @@ dependencies:
|
|
87
87
|
version: '3.0'
|
88
88
|
type: :runtime
|
89
89
|
prerelease: false
|
90
|
-
version_requirements: *
|
90
|
+
version_requirements: *70203421644700
|
91
91
|
- !ruby/object:Gem::Dependency
|
92
92
|
name: activerecord
|
93
|
-
requirement: &
|
93
|
+
requirement: &70203421642920 !ruby/object:Gem::Requirement
|
94
94
|
none: false
|
95
95
|
requirements:
|
96
96
|
- - ~>
|
@@ -98,10 +98,10 @@ dependencies:
|
|
98
98
|
version: '3.0'
|
99
99
|
type: :runtime
|
100
100
|
prerelease: false
|
101
|
-
version_requirements: *
|
101
|
+
version_requirements: *70203421642920
|
102
102
|
- !ruby/object:Gem::Dependency
|
103
103
|
name: unicorn
|
104
|
-
requirement: &
|
104
|
+
requirement: &70203421640800 !ruby/object:Gem::Requirement
|
105
105
|
none: false
|
106
106
|
requirements:
|
107
107
|
- - ! '>='
|
@@ -109,10 +109,10 @@ dependencies:
|
|
109
109
|
version: '0'
|
110
110
|
type: :runtime
|
111
111
|
prerelease: false
|
112
|
-
version_requirements: *
|
112
|
+
version_requirements: *70203421640800
|
113
113
|
- !ruby/object:Gem::Dependency
|
114
114
|
name: sinatra
|
115
|
-
requirement: &
|
115
|
+
requirement: &70203421638140 !ruby/object:Gem::Requirement
|
116
116
|
none: false
|
117
117
|
requirements:
|
118
118
|
- - ! '>='
|
@@ -120,10 +120,10 @@ dependencies:
|
|
120
120
|
version: '0'
|
121
121
|
type: :runtime
|
122
122
|
prerelease: false
|
123
|
-
version_requirements: *
|
123
|
+
version_requirements: *70203421638140
|
124
124
|
- !ruby/object:Gem::Dependency
|
125
125
|
name: redis
|
126
|
-
requirement: &
|
126
|
+
requirement: &70203421634220 !ruby/object:Gem::Requirement
|
127
127
|
none: false
|
128
128
|
requirements:
|
129
129
|
- - ! '>='
|
@@ -131,10 +131,10 @@ dependencies:
|
|
131
131
|
version: '0'
|
132
132
|
type: :runtime
|
133
133
|
prerelease: false
|
134
|
-
version_requirements: *
|
134
|
+
version_requirements: *70203421634220
|
135
135
|
- !ruby/object:Gem::Dependency
|
136
136
|
name: mysql
|
137
|
-
requirement: &
|
137
|
+
requirement: &70203421631480 !ruby/object:Gem::Requirement
|
138
138
|
none: false
|
139
139
|
requirements:
|
140
140
|
- - ! '>='
|
@@ -142,7 +142,7 @@ dependencies:
|
|
142
142
|
version: '0'
|
143
143
|
type: :runtime
|
144
144
|
prerelease: false
|
145
|
-
version_requirements: *
|
145
|
+
version_requirements: *70203421631480
|
146
146
|
description: Fast Ruby semantic text search engine with comfortable single field interface.
|
147
147
|
email: florian.hanke+picky@gmail.com
|
148
148
|
executables:
|