picky 4.12.1 → 4.12.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (72) hide show
  1. data/lib/picky/backends/backend.rb +5 -3
  2. data/lib/picky/backends/file/basic.rb +1 -1
  3. data/lib/picky/backends/file/json.rb +1 -1
  4. data/lib/picky/backends/file.rb +5 -4
  5. data/lib/picky/backends/memory.rb +4 -4
  6. data/lib/picky/backends/prepared/text.rb +2 -0
  7. data/lib/picky/backends/redis.rb +1 -1
  8. data/lib/picky/bundle.rb +3 -3
  9. data/lib/picky/categories.rb +24 -14
  10. data/lib/picky/categories_convenience.rb +1 -2
  11. data/lib/picky/categories_indexed.rb +2 -4
  12. data/lib/picky/categories_indexing.rb +4 -4
  13. data/lib/picky/categories_realtime.rb +7 -7
  14. data/lib/picky/character_substituters/west_european.rb +1 -1
  15. data/lib/picky/extensions/class.rb +4 -4
  16. data/lib/picky/extensions/module.rb +29 -7
  17. data/lib/picky/index.rb +26 -25
  18. data/lib/picky/index_convenience.rb +1 -3
  19. data/lib/picky/index_indexed.rb +5 -5
  20. data/lib/picky/index_indexing.rb +2 -6
  21. data/lib/picky/index_realtime.rb +7 -7
  22. data/lib/picky/indexers/base.rb +2 -2
  23. data/lib/picky/indexes.rb +12 -17
  24. data/lib/picky/indexes_convenience.rb +1 -3
  25. data/lib/picky/indexes_indexed.rb +2 -5
  26. data/lib/picky/indexes_indexing.rb +2 -6
  27. data/lib/picky/loader.rb +1 -0
  28. data/lib/picky/query/allocation.rb +1 -1
  29. data/lib/picky/query/allocations.rb +7 -7
  30. data/lib/picky/query/boosts.rb +1 -2
  31. data/lib/picky/query/combinations.rb +3 -3
  32. data/lib/picky/query/indexes.rb +18 -18
  33. data/lib/picky/query/token.rb +1 -1
  34. data/lib/picky/query/tokens.rb +2 -2
  35. data/lib/picky/rack/harakiri.rb +1 -1
  36. data/lib/picky/results.rb +2 -2
  37. data/lib/picky/search.rb +5 -5
  38. data/lib/picky/search_facets.rb +3 -3
  39. data/lib/picky/sinatra.rb +1 -1
  40. data/lib/picky/tokenizer/regexp_wrapper.rb +19 -0
  41. data/lib/picky/tokenizer.rb +2 -13
  42. data/lib/picky/wrappers/bundle/delegators.rb +44 -44
  43. data/lib/picky/wrappers/bundle/wrapper.rb +1 -1
  44. data/lib/picky.rb +0 -2
  45. data/lib/tasks/server.rake +2 -1
  46. data/spec/functional/backends/redis_bundle_realtime_spec.rb +1 -1
  47. data/spec/functional/backends/sqlite_bundle_realtime_spec.rb +1 -1
  48. data/spec/functional/custom_delimiters_spec.rb +0 -2
  49. data/spec/functional/facets_spec.rb +1 -1
  50. data/spec/lib/backends/backend_spec.rb +1 -1
  51. data/spec/lib/backends/file/basic_spec.rb +1 -1
  52. data/spec/lib/backends/file_spec.rb +1 -1
  53. data/spec/lib/backends/memory/json_spec.rb +1 -1
  54. data/spec/lib/backends/memory/marshal_spec.rb +1 -1
  55. data/spec/lib/backends/redis/float_spec.rb +1 -1
  56. data/spec/lib/backends/redis/string_spec.rb +1 -1
  57. data/spec/lib/backends/sqlite/array_spec.rb +2 -2
  58. data/spec/lib/backends/sqlite/value_spec.rb +1 -1
  59. data/spec/lib/category_indexing_spec.rb +1 -1
  60. data/spec/lib/extensions/module_spec.rb +43 -6
  61. data/spec/lib/index_indexed_spec.rb +2 -2
  62. data/spec/lib/index_spec.rb +22 -1
  63. data/spec/lib/indexers/base_spec.rb +1 -1
  64. data/spec/lib/indexes_indexing_spec.rb +2 -2
  65. data/spec/lib/query/allocation_spec.rb +3 -3
  66. data/spec/lib/query/allocations_spec.rb +6 -6
  67. data/spec/lib/query/combinations_spec.rb +1 -1
  68. data/spec/lib/query/tokens_spec.rb +13 -13
  69. data/spec/lib/results_spec.rb +2 -2
  70. data/spec/lib/search_spec.rb +4 -4
  71. data/spec/lib/sinatra_spec.rb +2 -2
  72. metadata +5 -4
@@ -10,7 +10,7 @@ describe Picky::Query::Allocation do
10
10
  end
11
11
 
12
12
  # describe "hash" do
13
- # it "delegates to the combinations" do
13
+ # it "forwards to the combinations" do
14
14
  # @combinations.should_receive(:hash).once.with
15
15
  #
16
16
  # @allocation.hash
@@ -34,7 +34,7 @@ describe Picky::Query::Allocation do
34
34
  end
35
35
 
36
36
  describe 'remove' do
37
- it 'should delegate to the combinations' do
37
+ it 'should forward to the combinations' do
38
38
  @combinations.should_receive(:remove).once.with [:some_categories]
39
39
 
40
40
  @allocation.remove [:some_categories]
@@ -205,7 +205,7 @@ describe Picky::Query::Allocation do
205
205
 
206
206
  describe "calculate_score" do
207
207
  context 'non-empty combinations' do
208
- it 'should delegate to backend and combinations' do
208
+ it 'should forward to backend and combinations' do
209
209
  @backend.should_receive(:weight).once.with(@combinations).and_return 1
210
210
  @combinations.should_receive(:boost_for).once.with(:some_boosts).and_return 2
211
211
 
@@ -287,7 +287,7 @@ describe Picky::Query::Allocations do
287
287
  @allocation = stub :allocation
288
288
  @allocations = described_class.new [@allocation, @allocation, @allocation]
289
289
  end
290
- it 'should delegate to each allocation with no params' do
290
+ it 'should forward to each allocation with no params' do
291
291
  @allocation.should_receive(:to_result).exactly(3).times.with
292
292
 
293
293
  @allocations.to_result
@@ -299,7 +299,7 @@ describe Picky::Query::Allocations do
299
299
  @no_result_allocation = stub :no_results, :to_result => nil
300
300
  @allocations = described_class.new [@allocation, @no_result_allocation, @allocation]
301
301
  end
302
- it 'should delegate to each allocation with the same params' do
302
+ it 'should forward to each allocation with the same params' do
303
303
  @allocations.to_result.should == [:some_result, :some_result]
304
304
  end
305
305
  end
@@ -337,7 +337,7 @@ describe Picky::Query::Allocations do
337
337
  @internal_allocations = mock :internal_allocations
338
338
  @allocations = described_class.new @internal_allocations
339
339
  end
340
- it "should delegate to the internal allocations" do
340
+ it "should forward to the internal allocations" do
341
341
  stub_proc = lambda {}
342
342
  @internal_allocations.should_receive(:each).once.with &stub_proc
343
343
 
@@ -349,7 +349,7 @@ describe Picky::Query::Allocations do
349
349
  @internal_allocations = mock :internal_allocations
350
350
  @allocations = described_class.new @internal_allocations
351
351
  end
352
- it "should delegate to the internal allocations" do
352
+ it "should forward to the internal allocations" do
353
353
  stub_proc = lambda {}
354
354
  @internal_allocations.should_receive(:inject).once.with &stub_proc
355
355
 
@@ -361,7 +361,7 @@ describe Picky::Query::Allocations do
361
361
  @internal_allocations = mock :internal_allocations
362
362
  @allocations = described_class.new @internal_allocations
363
363
  end
364
- it "should delegate to the internal allocations array" do
364
+ it "should forward to the internal allocations array" do
365
365
  @internal_allocations.should_receive(:empty?).once
366
366
  @allocations.empty?
367
367
  end
@@ -373,7 +373,7 @@ describe Picky::Query::Allocations do
373
373
  @no_result_allocation = stub :no_results, :to_result => nil
374
374
  @allocations = described_class.new [@allocation, @no_result_allocation, @allocation]
375
375
  end
376
- it "should delegate to the internal allocations array" do
376
+ it "should forward to the internal allocations array" do
377
377
  @allocations.to_s.should == "[:some_result, :some_result]"
378
378
  end
379
379
  end
@@ -48,7 +48,7 @@ describe Picky::Query::Combinations do
48
48
  end
49
49
 
50
50
  # describe 'hash' do
51
- # it "delegates to the combinations array" do
51
+ # it "forwards to the combinations array" do
52
52
  # @combinations_ary.should_receive(:hash).once.with
53
53
  #
54
54
  # @combinations.hash
@@ -226,13 +226,13 @@ describe Picky::Query::Tokens do
226
226
  end
227
227
  end
228
228
 
229
- def self.it_should_delegate name
229
+ def self.it_should_forward name
230
230
  describe name do
231
231
  before(:each) do
232
232
  @internal_tokens = mock :internal_tokens
233
233
  @tokens = described_class.new @internal_tokens
234
234
  end
235
- it "should delegate #{name} to the internal tokens" do
235
+ it "should forward #{name} to the internal tokens" do
236
236
  proc_stub = lambda {}
237
237
 
238
238
  @internal_tokens.should_receive(name).once.with &proc_stub
@@ -244,17 +244,17 @@ describe Picky::Query::Tokens do
244
244
  # Reject is tested separately.
245
245
  #
246
246
  (Enumerable.instance_methods - [:reject]).each do |name|
247
- it_should_delegate name
247
+ it_should_forward name
248
248
  end
249
- it_should_delegate :slice!
250
- it_should_delegate :[]
251
- it_should_delegate :uniq!
252
- it_should_delegate :last
253
- it_should_delegate :length
254
- it_should_delegate :reject!
255
- it_should_delegate :size
256
- it_should_delegate :empty?
257
- it_should_delegate :each
258
- it_should_delegate :exit
249
+ it_should_forward :slice!
250
+ it_should_forward :[]
251
+ it_should_forward :uniq!
252
+ it_should_forward :last
253
+ it_should_forward :length
254
+ it_should_forward :reject!
255
+ it_should_forward :size
256
+ it_should_forward :empty?
257
+ it_should_forward :each
258
+ it_should_forward :exit
259
259
 
260
260
  end
@@ -19,12 +19,12 @@ describe Picky::Results do
19
19
  @allocations = stub :allocations
20
20
  @results = described_class.new :unimportant, :amount, :unimportant, @allocations
21
21
  end
22
- it "delegates" do
22
+ it "forwards" do
23
23
  @allocations.should_receive(:ids).once.with :anything
24
24
 
25
25
  @results.ids :anything
26
26
  end
27
- it "delegates and uses amount if nothing given" do
27
+ it "forwards and uses amount if nothing given" do
28
28
  @allocations.should_receive(:ids).once.with :amount
29
29
 
30
30
  @results.ids
@@ -14,7 +14,7 @@ describe Picky::Search do
14
14
 
15
15
  describe 'tokenized' do
16
16
  let(:search) { described_class.new }
17
- it 'delegates to the tokenizer' do
17
+ it 'forwards to the tokenizer' do
18
18
  tokenizer = stub :tokenizer
19
19
  search.stub! :tokenizer => tokenizer
20
20
 
@@ -88,21 +88,21 @@ describe Picky::Search do
88
88
  before(:each) do
89
89
  @search = described_class.new
90
90
  end
91
- it "delegates to search_with correctly" do
91
+ it "forwards to search_with correctly" do
92
92
  @search.stub! :tokenized => :tokens
93
93
 
94
94
  @search.should_receive(:search_with).once.with :tokens, 20, 10, :text, nil
95
95
 
96
96
  @search.search :text, 20, 10
97
97
  end
98
- it "delegates to search_with correctly" do
98
+ it "forwards to search_with correctly" do
99
99
  @search.stub! :tokenized => :tokens
100
100
 
101
101
  @search.should_receive(:search_with).once.with :tokens, 20, 0, :text, nil
102
102
 
103
103
  @search.search :text, 20, 0
104
104
  end
105
- it "delegates to search_with correctly" do
105
+ it "forwards to search_with correctly" do
106
106
  @search.stub! :tokenized => :tokens
107
107
 
108
108
  @search.should_receive(:search_with).once.with :tokens, 20, 0, :text, true
@@ -21,12 +21,12 @@ describe Picky::Sinatra do
21
21
  it 'has Picky specific methods' do
22
22
  extendee.send :searching, splits_text_on: /something/
23
23
  end
24
- it 'gets delegated correctly' do
24
+ it 'gets forwardd correctly' do
25
25
  Picky::Tokenizer.should_receive(:default_indexing_with).once.with some: 'option'
26
26
 
27
27
  extendee.send :indexing, some: 'option'
28
28
  end
29
- it 'gets delegated correctly' do
29
+ it 'gets forwardd correctly' do
30
30
  Picky::Tokenizer.should_receive(:default_searching_with).once.with some: 'option'
31
31
 
32
32
  extendee.send :searching, some: 'option'
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.12.1
4
+ version: 4.12.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-11-26 00:00:00.000000000 Z
12
+ date: 2012-12-03 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rspec
@@ -34,7 +34,7 @@ dependencies:
34
34
  requirements:
35
35
  - - ~>
36
36
  - !ruby/object:Gem::Version
37
- version: 4.12.1
37
+ version: 4.12.2
38
38
  type: :development
39
39
  prerelease: false
40
40
  version_requirements: !ruby/object:Gem::Requirement
@@ -42,7 +42,7 @@ dependencies:
42
42
  requirements:
43
43
  - - ~>
44
44
  - !ruby/object:Gem::Version
45
- version: 4.12.1
45
+ version: 4.12.2
46
46
  - !ruby/object:Gem::Dependency
47
47
  name: text
48
48
  requirement: !ruby/object:Gem::Requirement
@@ -245,6 +245,7 @@ files:
245
245
  - lib/picky/splitters/automatic.rb
246
246
  - lib/picky/statistics.rb
247
247
  - lib/picky/tasks.rb
248
+ - lib/picky/tokenizer/regexp_wrapper.rb
248
249
  - lib/picky/tokenizer.rb
249
250
  - lib/picky/wrappers/bundle/calculation.rb
250
251
  - lib/picky/wrappers/bundle/delegators.rb