picky 4.13.0 → 4.13.1

Sign up to get free protection for your applications and to get access to all the features.
data/lib/picky/loader.rb CHANGED
@@ -63,8 +63,7 @@ module Picky
63
63
  'extensions/symbol',
64
64
  'extensions/string',
65
65
  'extensions/module',
66
- 'extensions/class',
67
- 'extensions/hash'
66
+ 'extensions/class'
68
67
  end
69
68
  def load_helpers
70
69
  load_relative 'helpers/measuring',
@@ -105,14 +105,6 @@ module Picky
105
105
  def to_result
106
106
  [self.result_identifier, self.score, self.count, @combinations.to_result, self.ids] if self.count && self.count > 0
107
107
  end
108
-
109
- # Json representation of this allocation.
110
- #
111
- # Note: Forwards to to_result.
112
- #
113
- def to_json options = {}
114
- MultiJson.encode to_result, options
115
- end
116
108
 
117
109
  #
118
110
  #
@@ -63,7 +63,7 @@ module Picky
63
63
  def remove_allocations qualifiers_array = []
64
64
  return if qualifiers_array.empty?
65
65
  @allocations.select! do |allocation|
66
- allocation_qualifiers = allocation.combinations.to_qualifiers
66
+ allocation_qualifiers = allocation.combinations.to_qualifiers.clustered_uniq
67
67
  next(false) if qualifiers_array.any? do |qualifiers|
68
68
  allocation_qualifiers == qualifiers
69
69
  end
@@ -80,7 +80,7 @@ module Picky
80
80
  def keep_allocations qualifiers_array = []
81
81
  return if qualifiers_array.empty?
82
82
  @allocations.select! do |allocation|
83
- allocation_qualifiers = allocation.combinations.to_qualifiers
83
+ allocation_qualifiers = allocation.combinations.to_qualifiers.clustered_uniq
84
84
  next(true) if qualifiers_array.any? do |qualifiers|
85
85
  allocation_qualifiers == qualifiers
86
86
  end
@@ -19,7 +19,7 @@ describe 'ignoring allocations' do
19
19
 
20
20
  try = Picky::Search.new index do
21
21
  ignore [:author, :text],
22
- [:text, :text]
22
+ [:text]
23
23
  end
24
24
 
25
25
  # These allocations are now removed.
@@ -6,7 +6,7 @@ require 'spec_helper'
6
6
  #
7
7
  describe 'ignoring allocations/categories' do
8
8
 
9
- it 'ignores categories/allocations correctly' do
9
+ it 'ignores single categories/allocations correctly' do
10
10
  index = Picky::Index.new :books do
11
11
  category :author
12
12
  category :title
@@ -18,9 +18,7 @@ describe 'ignoring allocations/categories' do
18
18
  index.add thing.new(2, 'some name', 'some title', 'some text')
19
19
 
20
20
  try = Picky::Search.new index do
21
- ignore [:author, :text],
22
- :text,
23
- [:text, :text]
21
+ ignore :text
24
22
  end
25
23
 
26
24
  # These categories/allocations are now removed.
@@ -31,7 +29,7 @@ describe 'ignoring allocations/categories' do
31
29
  [:books, 1.386, 2, [ [:title, "some", "some"]], [2, 1]],
32
30
  [:books, 1.386, 2, [[:title, "some", "some"], [:title, "some", "some"]], [2, 1]],
33
31
  [:books, 0.693, 1, [[:title, "some", "some"], [:author, "some", "some"]], [2]],
34
- # [:books, 0.693, 1, [[:author, "some", "some"], [:text, "some", "some"]], [2]],
32
+ [:books, 0.693, 1, [[:author, "some", "some"], ], [2]],
35
33
  [:books, 0.693, 1, [[:author, "some", "some"], [:title, "some", "some"]], [2]],
36
34
  [:books, 0.693, 1, [ [:author, "some", "some"]], [2]],
37
35
  [:books, 0.0, 1, [[:author, "some", "some"], [:author, "some", "some"]], [2]]
@@ -51,10 +49,10 @@ describe 'ignoring allocations/categories' do
51
49
 
52
50
  try = Picky::Search.new index do
53
51
  ignore [:author, :text],
54
- [:text, :text]
52
+ [:text]
55
53
  end
56
54
 
57
- # These allocations are now removed.
55
+ # These categories/allocations are now removed.
58
56
  #
59
57
  try.search('some some').allocations.to_result.should == [
60
58
  # [:books, 1.386, 2, [[:text, "some", "some"], [:text, "some", "some"]], [2, 1]],
@@ -67,67 +65,38 @@ describe 'ignoring allocations/categories' do
67
65
  [:books, 0.693, 1, [[:text, "some", "some"], [:author, "some", "some"]], [2]],
68
66
  [:books, 0.0, 1, [[:author, "some", "some"], [:author, "some", "some"]], [2]]
69
67
  ]
70
- end
71
-
72
- it 'keeps allocations correctly' do
73
- index = Picky::Index.new :books do
74
- category :author
75
- category :title
76
- category :text
77
- end
78
-
79
- thing = Struct.new :id, :author, :title, :text
80
- index.add thing.new(1, 'peter', 'some title', 'some text')
81
- index.add thing.new(2, 'some name', 'some title', 'some text')
82
68
 
83
- try = Picky::Search.new index do
84
- only [:author, :text],
85
- [:text, :text]
86
- end
87
-
88
- # These allocations are now exclusively kept.
69
+ # These categories/allocations are now removed.
89
70
  #
90
- try.search('some some').allocations.to_result.should == [
91
- [:books, 1.386, 2, [[:text, "some", "some"], [:text, "some", "some"]], [2, 1]],
92
- # [:books, 1.386, 2, [[:text, "some", "some"], [:title, "some", "some"]], [2, 1]],
93
- # [:books, 1.386, 2, [[:title, "some", "some"], [:text, "some", "some"]], [2, 1]],
94
- # [:books, 1.386, 2, [[:title, "some", "some"], [:title, "some", "some"]], [2, 1]],
95
- # [:books, 0.693, 1, [[:title, "some", "some"], [:author, "some", "some"]], [2]],
96
- [:books, 0.693, 1, [[:author, "some", "some"], [:text, "some", "some"]], [2]],
97
- # [:books, 0.693, 1, [[:author, "some", "some"], [:title, "some", "some"]], [2]],
98
- # [:books, 0.693, 1, [[:text, "some", "some"], [:author, "some", "some"]], [2]],
99
- # [:books, 0.0, 1, [[:author, "some", "some"], [:author, "some", "some"]], [2]]
71
+ try.search('some some some').allocations.to_result.should == [
72
+ # [:books, 2.0789999999999997, 2, [[:text, "some", "some"], [:text, "some", "some"], [:text, "some", "some"]], [2, 1]],
73
+ [:books, 2.0789999999999997, 2, [[:text, "some", "some"], [:text, "some", "some"], [:title, "some", "some"]], [2, 1]],
74
+ [:books, 2.0789999999999997, 2, [[:text, "some", "some"], [:title, "some", "some"], [:text, "some", "some"]], [2, 1]],
75
+ [:books, 2.0789999999999997, 2, [[:text, "some", "some"], [:title, "some", "some"], [:title, "some", "some"]], [2, 1]],
76
+ [:books, 2.0789999999999997, 2, [[:title, "some", "some"], [:text, "some", "some"], [:text, "some", "some"]], [2, 1]],
77
+ [:books, 2.0789999999999997, 2, [[:title, "some", "some"], [:text, "some", "some"], [:title, "some", "some"]], [2, 1]],
78
+ [:books, 2.0789999999999997, 2, [[:title, "some", "some"], [:title, "some", "some"], [:title, "some", "some"]], [2, 1]],
79
+ [:books, 2.0789999999999997, 2, [[:title, "some", "some"], [:title, "some", "some"], [:text, "some", "some"]], [2, 1]],
80
+ # [:books, 1.386, 1, [[:author, "some", "some"], [:text, "some", "some"], [:text, "some", "some"]], [2]],
81
+ [:books, 1.386, 1, [[:author, "some", "some"], [:title, "some", "some"], [:title, "some", "some"]], [2]],
82
+ [:books, 1.386, 1, [[:title, "some", "some"], [:author, "some", "some"], [:title, "some", "some"]], [2]],
83
+ [:books, 1.386, 1, [[:title, "some", "some"], [:author, "some", "some"], [:text, "some", "some"]], [2]],
84
+ [:books, 1.386, 1, [[:title, "some", "some"], [:title, "some", "some"], [:author, "some", "some"]], [2]],
85
+ [:books, 1.386, 1, [[:author, "some", "some"], [:text, "some", "some"], [:title, "some", "some"]], [2]],
86
+ [:books, 1.386, 1, [[:text, "some", "some"], [:text, "some", "some"], [:author, "some", "some"]], [2]],
87
+ [:books, 1.386, 1, [[:title, "some", "some"], [:text, "some", "some"], [:author, "some", "some"]], []],
88
+ [:books, 1.386, 1, [[:author, "some", "some"], [:title, "some", "some"], [:text, "some", "some"]], []],
89
+ [:books, 1.386, 1, [[:text, "some", "some"], [:title, "some", "some"], [:author, "some", "some"]], []],
90
+ [:books, 1.386, 1, [[:text, "some", "some"], [:author, "some", "some"], [:text, "some", "some"]], []],
91
+ [:books, 1.386, 1, [[:text, "some", "some"], [:author, "some", "some"], [:title, "some", "some"]], []],
92
+ [:books, 0.693, 1, [[:title, "some", "some"], [:author, "some", "some"], [:author, "some", "some"]], []],
93
+ [:books, 0.693, 1, [[:text, "some", "some"], [:author, "some", "some"], [:author, "some", "some"]], []],
94
+ [:books, 0.693, 1, [[:author, "some", "some"], [:title, "some", "some"], [:author, "some", "some"]], []],
95
+ [:books, 0.693, 1, [[:author, "some", "some"], [:author, "some", "some"], [:title, "some", "some"]], []],
96
+ [:books, 0.693, 1, [[:author, "some", "some"], [:text, "some", "some"], [:author, "some", "some"]], []],
97
+ # [:books, 0.693, 1, [[:author, "some", "some"], [:author, "some", "some"], [:text, "some", "some"]], []],
98
+ [:books, 0.0, 1, [[:author, "some", "some"], [:author, "some", "some"], [:author, "some", "some"]], []]
100
99
  ]
101
100
  end
102
101
 
103
- it 'performs far better' do
104
- index = Picky::Index.new :books do
105
- category :author
106
- category :title
107
- category :text
108
- end
109
-
110
- thing = Struct.new :id, :author, :title, :text
111
- index.add thing.new(1, 'peter', 'some title', 'some text')
112
- index.add thing.new(2, 'some name', 'some title', 'some text')
113
- index.add thing.new(3, 'peter', 'some title', 'some text')
114
- index.add thing.new(4, 'some name', 'some title', 'some text')
115
- index.add thing.new(5, 'peter', 'some title', 'some text')
116
- index.add thing.new(6, 'some name', 'some title', 'some text')
117
- index.add thing.new(7, 'peter', 'some title', 'some text')
118
- index.add thing.new(8, 'some name', 'some title', 'some text')
119
-
120
- try = Picky::Search.new index
121
-
122
- # Reasonably fast.
123
- #
124
- performance_of { try.search('some some') }.should < 0.0005
125
-
126
- try.only [:author, :text],
127
- [:text, :text]
128
-
129
- # Much faster.
130
- #
131
- performance_of { try.search('some some') }.should < 0.000175
132
- end
133
102
  end
@@ -3,6 +3,100 @@
3
3
  require 'spec_helper'
4
4
 
5
5
  describe 'Search#only' do
6
+
7
+ it 'keeps allocations correctly' do
8
+ index = Picky::Index.new :books do
9
+ category :author
10
+ category :title
11
+ category :text
12
+ end
13
+
14
+ thing = Struct.new :id, :author, :title, :text
15
+ index.add thing.new(1, 'peter', 'some title', 'some text')
16
+ index.add thing.new(2, 'some name', 'some title', 'some text')
17
+
18
+ try = Picky::Search.new index do
19
+ only [:author, :text],
20
+ [:text]
21
+ end
22
+
23
+ # These allocations are now exclusively kept.
24
+ #
25
+ try.search('some some').allocations.to_result.should == [
26
+ [:books, 1.386, 2, [[:text, "some", "some"], [:text, "some", "some"]], [2, 1]],
27
+ # [:books, 1.386, 2, [[:text, "some", "some"], [:title, "some", "some"]], [2, 1]],
28
+ # [:books, 1.386, 2, [[:title, "some", "some"], [:text, "some", "some"]], [2, 1]],
29
+ # [:books, 1.386, 2, [[:title, "some", "some"], [:title, "some", "some"]], [2, 1]],
30
+ # [:books, 0.693, 1, [[:title, "some", "some"], [:author, "some", "some"]], [2]],
31
+ [:books, 0.693, 1, [[:author, "some", "some"], [:text, "some", "some"]], [2]],
32
+ # [:books, 0.693, 1, [[:author, "some", "some"], [:title, "some", "some"]], [2]],
33
+ # [:books, 0.693, 1, [[:text, "some", "some"], [:author, "some", "some"]], [2]],
34
+ # [:books, 0.0, 1, [[:author, "some", "some"], [:author, "some", "some"]], [2]]
35
+ ]
36
+
37
+ # These allocations are now exclusively kept.
38
+ #
39
+ try.search('some some some').allocations.to_result.should == [
40
+ [:books, 2.0789999999999997, 2, [[:text, "some", "some"], [:text, "some", "some"], [:text, "some", "some"]], [2, 1]],
41
+ # [:books, 2.0789999999999997, 2, [[:text, "some", "some"], [:text, "some", "some"], [:title, "some", "some"]], [2, 1]],
42
+ # [:books, 2.0789999999999997, 2, [[:text, "some", "some"], [:title, "some", "some"], [:text, "some", "some"]], [2, 1]],
43
+ # [:books, 2.0789999999999997, 2, [[:text, "some", "some"], [:title, "some", "some"], [:title, "some", "some"]], [2, 1]],
44
+ # [:books, 2.0789999999999997, 2, [[:title, "some", "some"], [:text, "some", "some"], [:text, "some", "some"]], [2, 1]],
45
+ # [:books, 2.0789999999999997, 2, [[:title, "some", "some"], [:text, "some", "some"], [:title, "some", "some"]], [2, 1]],
46
+ # [:books, 2.0789999999999997, 2, [[:title, "some", "some"], [:title, "some", "some"], [:text, "some", "some"]], [2, 1]],
47
+ # [:books, 2.0789999999999997, 2, [[:title, "some", "some"], [:title, "some", "some"], [:title, "some", "some"]], [2, 1]],
48
+ [:books, 1.386, 1, [[:author, "some", "some"], [:text, "some", "some"], [:text, "some", "some"]], [2]],
49
+ # [:books, 1.386, 1, [[:text, "some", "some"], [:text, "some", "some"], [:author, "some", "some"]], [2]],
50
+ # [:books, 1.386, 1, [[:title, "some", "some"], [:author, "some", "some"], [:title, "some", "some"]], [2]],
51
+ # [:books, 1.386, 1, [[:title, "some", "some"], [:author, "some", "some"], [:text, "some", "some"]], [2]],
52
+ # [:books, 1.386, 1, [[:title, "some", "some"], [:title, "some", "some"], [:author, "some", "some"]], []],
53
+ # [:books, 1.386, 1, [[:author, "some", "some"], [:text, "some", "some"], [:title, "some", "some"]], []],
54
+ # [:books, 1.386, 1, [[:text, "some", "some"], [:title, "some", "some"], [:author, "some", "some"]], []],
55
+ # [:books, 1.386, 1, [[:title, "some", "some"], [:text, "some", "some"], [:author, "some", "some"]], []],
56
+ # [:books, 1.386, 1, [[:author, "some", "some"], [:title, "some", "some"], [:text, "some", "some"]], []],
57
+ # [:books, 1.386, 1, [[:text, "some", "some"], [:author, "some", "some"], [:title, "some", "some"]], []],
58
+ # [:books, 1.386, 1, [[:text, "some", "some"], [:author, "some", "some"], [:text, "some", "some"]], []],
59
+ # [:books, 1.386, 1, [[:author, "some", "some"], [:title, "some", "some"], [:title, "some", "some"]], []],
60
+ # [:books, 0.693, 1, [[:text, "some", "some"], [:author, "some", "some"], [:author, "some", "some"]], []],
61
+ # [:books, 0.693, 1, [[:author, "some", "some"], [:text, "some", "some"], [:author, "some", "some"]], []],
62
+ # [:books, 0.693, 1, [[:author, "some", "some"], [:title, "some", "some"], [:author, "some", "some"]], []],
63
+ # [:books, 0.693, 1, [[:author, "some", "some"], [:author, "some", "some"], [:title, "some", "some"]], []],
64
+ # [:books, 0.693, 1, [[:title, "some", "some"], [:author, "some", "some"], [:author, "some", "some"]], []],
65
+ [:books, 0.693, 1, [[:author, "some", "some"], [:author, "some", "some"], [:text, "some", "some"]], [2]],
66
+ # [:books, 0.0, 1, [[:author, "some", "some"], [:author, "some", "some"], [:author, "some", "some"]], []]
67
+ ]
68
+ end
69
+
70
+ it 'performs far better' do
71
+ index = Picky::Index.new :books do
72
+ category :author
73
+ category :title
74
+ category :text
75
+ end
76
+
77
+ thing = Struct.new :id, :author, :title, :text
78
+ index.add thing.new(1, 'peter', 'some title', 'some text')
79
+ index.add thing.new(2, 'some name', 'some title', 'some text')
80
+ index.add thing.new(3, 'peter', 'some title', 'some text')
81
+ index.add thing.new(4, 'some name', 'some title', 'some text')
82
+ index.add thing.new(5, 'peter', 'some title', 'some text')
83
+ index.add thing.new(6, 'some name', 'some title', 'some text')
84
+ index.add thing.new(7, 'peter', 'some title', 'some text')
85
+ index.add thing.new(8, 'some name', 'some title', 'some text')
86
+
87
+ try = Picky::Search.new index
88
+
89
+ # Reasonably fast.
90
+ #
91
+ performance_of { try.search('some some') }.should < 0.0005
92
+
93
+ try.only [:author, :text],
94
+ [:text, :text]
95
+
96
+ # Much faster.
97
+ #
98
+ performance_of { try.search('some some') }.should < 0.000175
99
+ end
6
100
 
7
101
  it 'offers the option only' do
8
102
  index = Picky::Index.new :only do
@@ -4,6 +4,10 @@ require 'spec_helper'
4
4
 
5
5
  describe Picky::Tokenizer do
6
6
  describe 'examples' do
7
+ it 'leaves a dash alone by default' do
8
+ tokenizer = described_class.new
9
+ tokenizer.tokenize('title1-').should == [['title1-'], ['title1-']]
10
+ end
7
11
  it 'works correctly' do
8
12
  tokenizer = described_class.new(normalizes_words: [[/\&/, 'and']])
9
13
 
@@ -9,14 +9,6 @@ describe Picky::Query::Allocation do
9
9
  @allocation = described_class.new @index, @combinations
10
10
  end
11
11
 
12
- # describe "hash" do
13
- # it "forwards to the combinations" do
14
- # @combinations.should_receive(:hash).once.with
15
- #
16
- # @allocation.hash
17
- # end
18
- # end
19
-
20
12
  describe "to_s" do
21
13
  before(:each) do
22
14
  @combinations.stub! :to_result => 'combinations_result'
@@ -189,20 +181,6 @@ describe Picky::Query::Allocation do
189
181
  end
190
182
  end
191
183
 
192
- describe 'to_json' do
193
- before(:each) do
194
- @allocation = described_class.new @index, stub(:combination, :empty? => false, :to_result => [:some_result1, :some_result2])
195
- @allocation.instance_variable_set :@score, :some_score
196
- end
197
- it 'should output the correct json string' do
198
- @backend.stub! :ids => [1,2,3,4,5,6,7]
199
-
200
- @allocation.process! 20, 0
201
-
202
- @allocation.to_json.should == '["some_result_identifier","some_score",7,["some_result1","some_result2"],[1,2,3,4,5,6,7]]'
203
- end
204
- end
205
-
206
184
  describe "calculate_score" do
207
185
  context 'non-empty combinations' do
208
186
  it 'should forward to backend and combinations' do
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: 4.13.0
4
+ version: 4.13.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-02-18 00:00:00.000000000 Z
12
+ date: 2013-03-01 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rspec
16
- requirement: !ruby/object:Gem::Requirement
16
+ requirement: &70248447814120 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,31 +21,21 @@ dependencies:
21
21
  version: '0'
22
22
  type: :development
23
23
  prerelease: false
24
- version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
- requirements:
27
- - - ! '>='
28
- - !ruby/object:Gem::Version
29
- version: '0'
24
+ version_requirements: *70248447814120
30
25
  - !ruby/object:Gem::Dependency
31
26
  name: picky-client
32
- requirement: !ruby/object:Gem::Requirement
27
+ requirement: &70248447750680 !ruby/object:Gem::Requirement
33
28
  none: false
34
29
  requirements:
35
30
  - - ~>
36
31
  - !ruby/object:Gem::Version
37
- version: 4.13.0
32
+ version: 4.13.1
38
33
  type: :development
39
34
  prerelease: false
40
- version_requirements: !ruby/object:Gem::Requirement
41
- none: false
42
- requirements:
43
- - - ~>
44
- - !ruby/object:Gem::Version
45
- version: 4.13.0
35
+ version_requirements: *70248447750680
46
36
  - !ruby/object:Gem::Dependency
47
37
  name: text
48
- requirement: !ruby/object:Gem::Requirement
38
+ requirement: &70248447748820 !ruby/object:Gem::Requirement
49
39
  none: false
50
40
  requirements:
51
41
  - - ! '>='
@@ -53,15 +43,10 @@ dependencies:
53
43
  version: '0'
54
44
  type: :runtime
55
45
  prerelease: false
56
- version_requirements: !ruby/object:Gem::Requirement
57
- none: false
58
- requirements:
59
- - - ! '>='
60
- - !ruby/object:Gem::Version
61
- version: '0'
46
+ version_requirements: *70248447748820
62
47
  - !ruby/object:Gem::Dependency
63
48
  name: multi_json
64
- requirement: !ruby/object:Gem::Requirement
49
+ requirement: &70248447747100 !ruby/object:Gem::Requirement
65
50
  none: false
66
51
  requirements:
67
52
  - - ! '>='
@@ -69,15 +54,10 @@ dependencies:
69
54
  version: '0'
70
55
  type: :runtime
71
56
  prerelease: false
72
- version_requirements: !ruby/object:Gem::Requirement
73
- none: false
74
- requirements:
75
- - - ! '>='
76
- - !ruby/object:Gem::Version
77
- version: '0'
57
+ version_requirements: *70248447747100
78
58
  - !ruby/object:Gem::Dependency
79
59
  name: activesupport
80
- requirement: !ruby/object:Gem::Requirement
60
+ requirement: &70248447744720 !ruby/object:Gem::Requirement
81
61
  none: false
82
62
  requirements:
83
63
  - - ! '>='
@@ -85,15 +65,10 @@ dependencies:
85
65
  version: '3.0'
86
66
  type: :runtime
87
67
  prerelease: false
88
- version_requirements: !ruby/object:Gem::Requirement
89
- none: false
90
- requirements:
91
- - - ! '>='
92
- - !ruby/object:Gem::Version
93
- version: '3.0'
68
+ version_requirements: *70248447744720
94
69
  - !ruby/object:Gem::Dependency
95
70
  name: rack_fast_escape
96
- requirement: !ruby/object:Gem::Requirement
71
+ requirement: &70248447728420 !ruby/object:Gem::Requirement
97
72
  none: false
98
73
  requirements:
99
74
  - - ! '>='
@@ -101,12 +76,7 @@ dependencies:
101
76
  version: '0'
102
77
  type: :runtime
103
78
  prerelease: false
104
- version_requirements: !ruby/object:Gem::Requirement
105
- none: false
106
- requirements:
107
- - - ! '>='
108
- - !ruby/object:Gem::Version
109
- version: '0'
79
+ version_requirements: *70248447728420
110
80
  description: Fast Ruby semantic text search engine with comfortable single field interface.
111
81
  email: florian.hanke+picky@gmail.com
112
82
  executables:
@@ -169,7 +139,6 @@ files:
169
139
  - lib/picky/constants.rb
170
140
  - lib/picky/extensions/array.rb
171
141
  - lib/picky/extensions/class.rb
172
- - lib/picky/extensions/hash.rb
173
142
  - lib/picky/extensions/module.rb
174
143
  - lib/picky/extensions/object.rb
175
144
  - lib/picky/extensions/string.rb
@@ -280,11 +249,11 @@ files:
280
249
  - spec/functional/error_messages_spec.rb
281
250
  - spec/functional/exact_first_spec.rb
282
251
  - spec/functional/facets_spec.rb
252
+ - spec/functional/ignore_allocations_spec.rb
283
253
  - spec/functional/ignore_spec.rb
284
254
  - spec/functional/max_allocations_spec.rb
285
255
  - spec/functional/multi_index_qualifier_spec.rb
286
256
  - spec/functional/non_specific_ids_larger_than_20_spec.rb
287
- - spec/functional/only_allocations_spec.rb
288
257
  - spec/functional/only_spec.rb
289
258
  - spec/functional/pool_spec.rb
290
259
  - spec/functional/range_queries_spec.rb
@@ -338,7 +307,6 @@ files:
338
307
  - spec/lib/character_substituters/polish_spec.rb
339
308
  - spec/lib/character_substituters/west_european_spec.rb
340
309
  - spec/lib/extensions/array_spec.rb
341
- - spec/lib/extensions/hash_spec.rb
342
310
  - spec/lib/extensions/module_spec.rb
343
311
  - spec/lib/extensions/object_spec.rb
344
312
  - spec/lib/extensions/string_spec.rb
@@ -427,7 +395,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
427
395
  version: '0'
428
396
  requirements: []
429
397
  rubyforge_project: http://rubyforge.org/projects/picky
430
- rubygems_version: 1.8.23
398
+ rubygems_version: 1.8.10
431
399
  signing_key:
432
400
  specification_version: 3
433
401
  summary: ! 'Picky: Semantic Search Engine. Clever Interface. Good Tools.'
@@ -449,11 +417,11 @@ test_files:
449
417
  - spec/functional/error_messages_spec.rb
450
418
  - spec/functional/exact_first_spec.rb
451
419
  - spec/functional/facets_spec.rb
420
+ - spec/functional/ignore_allocations_spec.rb
452
421
  - spec/functional/ignore_spec.rb
453
422
  - spec/functional/max_allocations_spec.rb
454
423
  - spec/functional/multi_index_qualifier_spec.rb
455
424
  - spec/functional/non_specific_ids_larger_than_20_spec.rb
456
- - spec/functional/only_allocations_spec.rb
457
425
  - spec/functional/only_spec.rb
458
426
  - spec/functional/pool_spec.rb
459
427
  - spec/functional/range_queries_spec.rb
@@ -507,7 +475,6 @@ test_files:
507
475
  - spec/lib/character_substituters/polish_spec.rb
508
476
  - spec/lib/character_substituters/west_european_spec.rb
509
477
  - spec/lib/extensions/array_spec.rb
510
- - spec/lib/extensions/hash_spec.rb
511
478
  - spec/lib/extensions/module_spec.rb
512
479
  - spec/lib/extensions/object_spec.rb
513
480
  - spec/lib/extensions/string_spec.rb
@@ -575,4 +542,3 @@ test_files:
575
542
  - spec/lib/tasks/try_spec.rb
576
543
  - spec/lib/tokenizer_spec.rb
577
544
  - spec/performant_spec.rb
578
- has_rdoc:
@@ -1,11 +0,0 @@
1
- # Extensions for the Hash.
2
- #
3
- class Hash
4
-
5
- # Use multi_json's encoding.
6
- #
7
- def to_json options = {}
8
- MultiJson.encode self, options
9
- end
10
-
11
- end
@@ -1,41 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe Hash do
4
-
5
- describe "to_json" do
6
- let(:obj) do
7
- # A very realistic example.
8
- #
9
- { :allocations => [
10
- ['c', 17.53, 275179, [["name","s*","s"]],[]],
11
- ['c', 15.01, 164576, [["category","s*","s"]],[]],
12
- ['p', 12.94, 415634, [["street","s*","s"]],[]],
13
- ['p', 12.89, 398247, [["name","s*","s"]],[]],
14
- ['p', 12.67, 318912, [["city","s*","s"]],[]],
15
- ['p', 12.37, 235933, [["first_name","s*","s"]],[]],
16
- ["p", 11.76, 128259, [["maiden_name","s*","s"]],[]],
17
- ['p', 11.73, 124479, [["occupation","s*","s"]],[]],
18
- ['c', 11.35, 84807, [["street","s*","s"]],[]],
19
- ['c', 11.15, 69301, [["city","s*","s"]],[]],
20
- ['p', 4.34, 77, [["street_number","s*","s"]],[]],
21
- ['c', 2.08, 8, [["street_number","s*","s"]],[]],
22
- ['c', 1.61, 5, [["adword","s*","s"]],[]]
23
- ],
24
- :offset => 0,
25
- :duration => 0.04,
26
- :total => 2215417
27
- }
28
- end
29
- it "should be correct" do
30
- obj.to_json.should == '{"allocations":[["c",17.53,275179,[["name","s*","s"]],[]],["c",15.01,164576,[["category","s*","s"]],[]],["p",12.94,415634,[["street","s*","s"]],[]],["p",12.89,398247,[["name","s*","s"]],[]],["p",12.67,318912,[["city","s*","s"]],[]],["p",12.37,235933,[["first_name","s*","s"]],[]],["p",11.76,128259,[["maiden_name","s*","s"]],[]],["p",11.73,124479,[["occupation","s*","s"]],[]],["c",11.35,84807,[["street","s*","s"]],[]],["c",11.15,69301,[["city","s*","s"]],[]],["p",4.34,77,[["street_number","s*","s"]],[]],["c",2.08,8,[["street_number","s*","s"]],[]],["c",1.61,5,[["adword","s*","s"]],[]]],"offset":0,"duration":0.04,"total":2215417}'
31
- end
32
- it "should take options" do
33
- lambda { obj.to_json(:some => :option) }.should_not raise_error
34
- end
35
- it "should be fast" do
36
- obj.to_json # Prerun
37
- performance_of { obj.to_json }.should < 0.000065
38
- end
39
- end
40
-
41
- end