picky 3.6.14 → 3.6.15
Sign up to get free protection for your applications and to get access to all the features.
@@ -70,7 +70,7 @@ module Picky
|
|
70
70
|
# Transform the allocation into result form.
|
71
71
|
#
|
72
72
|
def to_result
|
73
|
-
[self.result_identifier, self.score, self.count, @combinations.to_result, self.ids] if self.count > 0
|
73
|
+
[self.result_identifier, self.score, self.count, @combinations.to_result, self.ids] if self.count && self.count > 0
|
74
74
|
end
|
75
75
|
|
76
76
|
# Json representation of this allocation.
|
@@ -103,12 +103,6 @@ module Picky
|
|
103
103
|
@allocations
|
104
104
|
end
|
105
105
|
|
106
|
-
# Simply inspects the internal allocations.
|
107
|
-
#
|
108
|
-
def to_s
|
109
|
-
@allocations.inspect
|
110
|
-
end
|
111
|
-
|
112
106
|
# Allocations for results are in the form:
|
113
107
|
# [
|
114
108
|
# allocation1.to_result,
|
@@ -120,6 +114,12 @@ module Picky
|
|
120
114
|
@allocations.map(&:to_result).compact
|
121
115
|
end
|
122
116
|
|
117
|
+
# Simply inspects the internal allocations.
|
118
|
+
#
|
119
|
+
def to_s
|
120
|
+
to_result.inspect
|
121
|
+
end
|
122
|
+
|
123
123
|
end
|
124
124
|
|
125
125
|
end
|
@@ -49,6 +49,17 @@ describe 'Search#terminate_early' do
|
|
49
49
|
try.search('hello', 9, 22).ids.should == [2, 1]
|
50
50
|
try.search('hello', 9, 25).ids.should == []
|
51
51
|
|
52
|
+
try.search('hello', 9).to_hash[:allocations].size.should == 2
|
53
|
+
try.search('hello', 9, 4).to_hash[:allocations].size.should == 3
|
54
|
+
try.search('hello', 9, 7).to_hash[:allocations].size.should == 3
|
55
|
+
try.search('hello', 9, 10).to_hash[:allocations].size.should == 4
|
56
|
+
try.search('hello', 9, 13).to_hash[:allocations].size.should == 4
|
57
|
+
try.search('hello', 9, 16).to_hash[:allocations].size.should == 4
|
58
|
+
try.search('hello', 9, 19).to_hash[:allocations].size.should == 4
|
59
|
+
try.search('hello', 9, 22).to_hash[:allocations].size.should == 4
|
60
|
+
try.search('hello', 9, 25).to_hash[:allocations].size.should == 4
|
61
|
+
|
62
|
+
|
52
63
|
try = Picky::Search.new index do
|
53
64
|
terminate_early 0
|
54
65
|
end
|
@@ -68,6 +79,12 @@ describe 'Search#terminate_early' do
|
|
68
79
|
try.search('hello', 13, 12).ids.should == [6, 5, 4, 3, 2, 1, 6, 5, 4, 3, 2, 1]
|
69
80
|
try.search('hello', 13, 16).ids.should == [2, 1, 6, 5, 4, 3, 2, 1]
|
70
81
|
|
82
|
+
try.search('hello', 13).to_hash[:allocations].size.should == 3
|
83
|
+
try.search('hello', 13, 4).to_hash[:allocations].size.should == 3
|
84
|
+
try.search('hello', 13, 8).to_hash[:allocations].size.should == 4
|
85
|
+
try.search('hello', 13, 12).to_hash[:allocations].size.should == 4
|
86
|
+
try.search('hello', 13, 16).to_hash[:allocations].size.should == 4
|
87
|
+
|
71
88
|
try = Picky::Search.new index do
|
72
89
|
terminate_early with_extra_allocations: 2
|
73
90
|
end
|
@@ -78,6 +95,23 @@ describe 'Search#terminate_early' do
|
|
78
95
|
end
|
79
96
|
try.search('hello').ids.should == [6, 5, 4, 3, 2, 1, 6, 5, 4, 3, 2, 1, 6, 5, 4, 3, 2, 1, 6, 5]
|
80
97
|
|
98
|
+
try = Picky::Search.new index do
|
99
|
+
terminate_early 1
|
100
|
+
end
|
101
|
+
try.search('hello', 1).ids.should == [6]
|
102
|
+
try.search('hello', 1, 4).ids.should == [2]
|
103
|
+
try.search('hello', 1, 8).ids.should == [4]
|
104
|
+
try.search('hello', 1, 12).ids.should == [6]
|
105
|
+
try.search('hello', 1, 16).ids.should == [2]
|
106
|
+
|
107
|
+
try.search('hello', 1).to_hash[:allocations].size.should == 2
|
108
|
+
try.search('hello', 1, 4).to_hash[:allocations].size.should == 2
|
109
|
+
try.search('hello', 1, 8).to_hash[:allocations].size.should == 2
|
110
|
+
try.search('hello', 1, 12).to_hash[:allocations].size.should == 3
|
111
|
+
try.search('hello', 1, 16).to_hash[:allocations].size.should == 3
|
112
|
+
try.search('hello', 1, 20).to_hash[:allocations].size.should == 4
|
113
|
+
try.search('hello', 1, 24).to_hash[:allocations].size.should == 4
|
114
|
+
|
81
115
|
GC.start
|
82
116
|
|
83
117
|
try_slow = Picky::Search.new index
|
@@ -362,12 +362,12 @@ describe Picky::Query::Allocations do
|
|
362
362
|
|
363
363
|
describe "to_s" do
|
364
364
|
before(:each) do
|
365
|
-
@
|
366
|
-
@
|
365
|
+
@allocation = stub :allocation, :to_result => :some_result
|
366
|
+
@no_result_allocation = stub :no_results, :to_result => nil
|
367
|
+
@allocations = described_class.new [@allocation, @no_result_allocation, @allocation]
|
367
368
|
end
|
368
369
|
it "should delegate to the internal allocations array" do
|
369
|
-
@
|
370
|
-
@allocations.to_s
|
370
|
+
@allocations.to_s.should == "[:some_result, :some_result]"
|
371
371
|
end
|
372
372
|
end
|
373
373
|
|
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.6.
|
4
|
+
version: 3.6.15
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -13,7 +13,7 @@ date: 2011-12-01 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rspec
|
16
|
-
requirement: &
|
16
|
+
requirement: &70213132195120 !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: *70213132195120
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: picky-client
|
27
|
-
requirement: &
|
27
|
+
requirement: &70213132210660 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ~>
|
31
31
|
- !ruby/object:Gem::Version
|
32
|
-
version: 3.6.
|
32
|
+
version: 3.6.15
|
33
33
|
type: :development
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *70213132210660
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: rack
|
38
|
-
requirement: &
|
38
|
+
requirement: &70213132210060 !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: *70213132210060
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: rack_fast_escape
|
49
|
-
requirement: &
|
49
|
+
requirement: &70213132209440 !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: *70213132209440
|
58
58
|
- !ruby/object:Gem::Dependency
|
59
59
|
name: text
|
60
|
-
requirement: &
|
60
|
+
requirement: &70213132208820 !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: *70213132208820
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: yajl-ruby
|
71
|
-
requirement: &
|
71
|
+
requirement: &70213132208100 !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: *70213132208100
|
80
80
|
- !ruby/object:Gem::Dependency
|
81
81
|
name: activesupport
|
82
|
-
requirement: &
|
82
|
+
requirement: &70213132207500 !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: *70213132207500
|
91
91
|
- !ruby/object:Gem::Dependency
|
92
92
|
name: unicorn
|
93
|
-
requirement: &
|
93
|
+
requirement: &70213132207060 !ruby/object:Gem::Requirement
|
94
94
|
none: false
|
95
95
|
requirements:
|
96
96
|
- - ! '>='
|
@@ -98,10 +98,10 @@ dependencies:
|
|
98
98
|
version: '0'
|
99
99
|
type: :runtime
|
100
100
|
prerelease: false
|
101
|
-
version_requirements: *
|
101
|
+
version_requirements: *70213132207060
|
102
102
|
- !ruby/object:Gem::Dependency
|
103
103
|
name: sinatra
|
104
|
-
requirement: &
|
104
|
+
requirement: &70213132206580 !ruby/object:Gem::Requirement
|
105
105
|
none: false
|
106
106
|
requirements:
|
107
107
|
- - ! '>='
|
@@ -109,7 +109,7 @@ dependencies:
|
|
109
109
|
version: '0'
|
110
110
|
type: :runtime
|
111
111
|
prerelease: false
|
112
|
-
version_requirements: *
|
112
|
+
version_requirements: *70213132206580
|
113
113
|
description: Fast Ruby semantic text search engine with comfortable single field interface.
|
114
114
|
email: florian.hanke+picky@gmail.com
|
115
115
|
executables:
|