picky 4.19.1 → 4.19.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -9,8 +9,6 @@ module Picky
9
9
  # This is the default behaviour and should be overridden
10
10
  # for different backends.
11
11
  #
12
- # TODO Push down.
13
- #
14
12
 
15
13
  # Returns an object that on #initial, #load returns
16
14
  # an object that responds to:
data/lib/picky/bundle.rb CHANGED
@@ -145,8 +145,6 @@ module Picky
145
145
 
146
146
  # If a key format is set, use it, else forward to the category.
147
147
  #
148
- # TODO Remove optimisation? @category.key_format
149
- #
150
148
  def key_format
151
149
  @key_format ||= @category.key_format
152
150
  end
data/lib/picky/index.rb CHANGED
@@ -297,9 +297,9 @@ module Picky
297
297
  end
298
298
  end
299
299
 
300
- # HIGHLY EXPERIMENTAL Not correctly working yet. Try it if you feel "beta".
300
+ # Geo search, searches in a rectangle (almost square) in the lat/long coordinate system.
301
301
  #
302
- # Also a range search see #ranged_category, but on the earth's surface.
302
+ # Note: It uses #ranged_category.
303
303
  #
304
304
  # Parameters:
305
305
  # * lat_name: The latitude's name as used in #category.
@@ -331,7 +331,6 @@ module Picky
331
331
  # indexed simultaneously, since lat/lng are correlated.
332
332
  #
333
333
  def geo_categories lat_name, lng_name, radius, options = {}
334
-
335
334
  # Extract lat/lng specific options.
336
335
  #
337
336
  lat_from = options.delete :lat_from
@@ -355,7 +354,6 @@ module Picky
355
354
  # So a km on the 45 degree line is equal to 0.01796624 degrees.
356
355
  #
357
356
  ranged_category lng_name, radius*0.01796624, options.merge(from: lng_from)
358
-
359
357
  end
360
358
 
361
359
  def to_stats
@@ -36,12 +36,12 @@ module Picky
36
36
  # query "alan history" and category :title is
37
37
  # ignored (ie. removed).
38
38
  #
39
- def calculate_score weights
39
+ def calculate_score boosts
40
40
  @score ||= if @combinations.empty?
41
41
  0 # Optimization.
42
42
  else
43
- # TODO Was @backend.score(@combinations) - indirection for maximum flexibility.
44
- @combinations.score + weights.boost_for(@combinations)
43
+ # Note: Was @backend.score(@combinations) - indirection for maximum flexibility.
44
+ @combinations.score + boosts.boost_for(@combinations)
45
45
  end
46
46
  end
47
47
 
@@ -28,9 +28,9 @@ module Picky
28
28
 
29
29
  # Score each allocation.
30
30
  #
31
- def calculate_score weights
31
+ def calculate_score boosts
32
32
  @allocations.each do |allocation|
33
- allocation.calculate_score weights
33
+ allocation.calculate_score boosts
34
34
  end
35
35
  end
36
36
 
@@ -62,14 +62,14 @@ module Picky
62
62
 
63
63
  # Returns a number of prepared (sorted, reduced etc.) allocations for the given tokens.
64
64
  #
65
- def prepared_allocations_for tokens, weights = {}, amount = nil
65
+ def prepared_allocations_for tokens, boosts = {}, amount = nil
66
66
  allocations = allocations_for tokens
67
67
 
68
68
  # Score the allocations using weights as bias.
69
69
  #
70
70
  # Note: Before we can sort them we need to score them.
71
71
  #
72
- allocations.calculate_score weights
72
+ allocations.calculate_score boosts
73
73
 
74
74
  # Filter the allocations – ignore/only.
75
75
  #
@@ -122,7 +122,7 @@ module Picky
122
122
  #
123
123
  self.partial = false or return if @similar
124
124
  self.partial = false or return if @text =~ @@no_partial
125
- self.partial = true if @text =~ @@partial # TODO Move this one line up since it occurs more often?
125
+ self.partial = true if @text =~ @@partial
126
126
  end
127
127
  # Define a character which stops a token from
128
128
  # being a partial token, even if it is the last token.
@@ -237,7 +237,7 @@ module Picky
237
237
  @text.gsub! @@illegals, EMPTY_STRING unless @text == EMPTY_STRING
238
238
  end
239
239
  def self.redefine_illegals
240
- # TODO Double no similar and no partial, both ".
240
+ # Note: By default, both no similar and no partial are ".
241
241
  #
242
242
  @@illegals = %r{[#@@no_similar_character#@@similar_character#@@no_partial_character#@@partial_character]}
243
243
  end
data/lib/picky.rb CHANGED
@@ -20,7 +20,11 @@ module Picky
20
20
  #
21
21
  # TODO Remove active support, as a goal.
22
22
  #
23
- require 'active_support/core_ext/logger'
23
+ begin
24
+ require 'active_support/logger' # Require Rails 4 recommended logger.
25
+ rescue LoadError
26
+ require 'active_support/core_ext/logger'
27
+ end
24
28
  require 'active_support/core_ext/object/blank'
25
29
  require 'active_support/multibyte'
26
30
  require 'multi_json'
@@ -185,9 +185,9 @@ describe Picky::Query::Allocation do
185
185
  context 'non-empty combinations' do
186
186
  it 'should forward to backend and combinations' do
187
187
  @combinations.should_receive(:score).once.and_return 1
188
- weights = stub :weights, :boost_for => 2
188
+ boosts = stub :weights, :boost_for => 2
189
189
 
190
- @allocation.calculate_score(weights).should == 3
190
+ @allocation.calculate_score(boosts).should == 3
191
191
  end
192
192
  end
193
193
  end
metadata CHANGED
@@ -1,111 +1,126 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: picky
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.19.1
4
+ version: 4.19.2
5
+ prerelease:
5
6
  platform: ruby
6
7
  authors:
7
8
  - Florian Hanke
8
9
  autorequire:
9
10
  bindir: bin
10
11
  cert_chain: []
11
- date: 2013-08-29 00:00:00.000000000 Z
12
+ date: 2013-11-20 00:00:00.000000000 Z
12
13
  dependencies:
13
14
  - !ruby/object:Gem::Dependency
14
15
  name: rspec
15
16
  requirement: !ruby/object:Gem::Requirement
17
+ none: false
16
18
  requirements:
17
- - - '>='
19
+ - - ! '>='
18
20
  - !ruby/object:Gem::Version
19
21
  version: '0'
20
22
  type: :development
21
23
  prerelease: false
22
24
  version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
23
26
  requirements:
24
- - - '>='
27
+ - - ! '>='
25
28
  - !ruby/object:Gem::Version
26
29
  version: '0'
27
30
  - !ruby/object:Gem::Dependency
28
31
  name: rake-compiler
29
32
  requirement: !ruby/object:Gem::Requirement
33
+ none: false
30
34
  requirements:
31
- - - '>='
35
+ - - ! '>='
32
36
  - !ruby/object:Gem::Version
33
37
  version: '0'
34
38
  type: :development
35
39
  prerelease: false
36
40
  version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
37
42
  requirements:
38
- - - '>='
43
+ - - ! '>='
39
44
  - !ruby/object:Gem::Version
40
45
  version: '0'
41
46
  - !ruby/object:Gem::Dependency
42
47
  name: picky-client
43
48
  requirement: !ruby/object:Gem::Requirement
49
+ none: false
44
50
  requirements:
45
51
  - - ~>
46
52
  - !ruby/object:Gem::Version
47
- version: 4.19.1
53
+ version: 4.19.2
48
54
  type: :development
49
55
  prerelease: false
50
56
  version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
51
58
  requirements:
52
59
  - - ~>
53
60
  - !ruby/object:Gem::Version
54
- version: 4.19.1
61
+ version: 4.19.2
55
62
  - !ruby/object:Gem::Dependency
56
63
  name: text
57
64
  requirement: !ruby/object:Gem::Requirement
65
+ none: false
58
66
  requirements:
59
- - - '>='
67
+ - - ! '>='
60
68
  - !ruby/object:Gem::Version
61
69
  version: '0'
62
70
  type: :runtime
63
71
  prerelease: false
64
72
  version_requirements: !ruby/object:Gem::Requirement
73
+ none: false
65
74
  requirements:
66
- - - '>='
75
+ - - ! '>='
67
76
  - !ruby/object:Gem::Version
68
77
  version: '0'
69
78
  - !ruby/object:Gem::Dependency
70
79
  name: multi_json
71
80
  requirement: !ruby/object:Gem::Requirement
81
+ none: false
72
82
  requirements:
73
- - - '>='
83
+ - - ! '>='
74
84
  - !ruby/object:Gem::Version
75
85
  version: '0'
76
86
  type: :runtime
77
87
  prerelease: false
78
88
  version_requirements: !ruby/object:Gem::Requirement
89
+ none: false
79
90
  requirements:
80
- - - '>='
91
+ - - ! '>='
81
92
  - !ruby/object:Gem::Version
82
93
  version: '0'
83
94
  - !ruby/object:Gem::Dependency
84
95
  name: activesupport
85
96
  requirement: !ruby/object:Gem::Requirement
97
+ none: false
86
98
  requirements:
87
- - - '>='
99
+ - - ! '>='
88
100
  - !ruby/object:Gem::Version
89
101
  version: '3.0'
90
102
  type: :runtime
91
103
  prerelease: false
92
104
  version_requirements: !ruby/object:Gem::Requirement
105
+ none: false
93
106
  requirements:
94
- - - '>='
107
+ - - ! '>='
95
108
  - !ruby/object:Gem::Version
96
109
  version: '3.0'
97
110
  - !ruby/object:Gem::Dependency
98
111
  name: rack_fast_escape
99
112
  requirement: !ruby/object:Gem::Requirement
113
+ none: false
100
114
  requirements:
101
- - - '>='
115
+ - - ! '>='
102
116
  - !ruby/object:Gem::Version
103
117
  version: '0'
104
118
  type: :runtime
105
119
  prerelease: false
106
120
  version_requirements: !ruby/object:Gem::Requirement
121
+ none: false
107
122
  requirements:
108
- - - '>='
123
+ - - ! '>='
109
124
  - !ruby/object:Gem::Version
110
125
  version: '0'
111
126
  description: Fast Ruby semantic text search engine with comfortable single field interface.
@@ -419,27 +434,28 @@ homepage: http://florianhanke.com/picky
419
434
  licenses:
420
435
  - MIT
421
436
  - LGPL
422
- metadata: {}
423
437
  post_install_message:
424
438
  rdoc_options: []
425
439
  require_paths:
426
440
  - lib
427
441
  required_ruby_version: !ruby/object:Gem::Requirement
442
+ none: false
428
443
  requirements:
429
- - - '>='
444
+ - - ! '>='
430
445
  - !ruby/object:Gem::Version
431
446
  version: '0'
432
447
  required_rubygems_version: !ruby/object:Gem::Requirement
448
+ none: false
433
449
  requirements:
434
- - - '>='
450
+ - - ! '>='
435
451
  - !ruby/object:Gem::Version
436
452
  version: '0'
437
453
  requirements: []
438
454
  rubyforge_project: http://rubyforge.org/projects/picky
439
- rubygems_version: 2.0.3
455
+ rubygems_version: 1.8.23
440
456
  signing_key:
441
- specification_version: 4
442
- summary: 'Picky: Semantic Search Engine. Clever Interface. Good Tools.'
457
+ specification_version: 3
458
+ summary: ! 'Picky: Semantic Search Engine. Clever Interface. Good Tools.'
443
459
  test_files:
444
460
  - spec/aux/picky/cli_spec.rb
445
461
  - spec/functional/allocations_uniq_by_definition_spec.rb
@@ -589,3 +605,4 @@ test_files:
589
605
  - spec/lib/tasks/try_spec.rb
590
606
  - spec/lib/tokenizer_spec.rb
591
607
  - spec/performant_spec.rb
608
+ has_rdoc:
checksums.yaml DELETED
@@ -1,7 +0,0 @@
1
- ---
2
- SHA1:
3
- metadata.gz: 421cbfb542c0270bb2f5f92c0ac16ea61ef32066
4
- data.tar.gz: d1e2bf8f29da7da6a8de80e770972d4d93adbc9b
5
- SHA512:
6
- metadata.gz: 654053145726c973ce4c94bdeb17631c0ab47260e3769a341ad9d724a60114b5dc094910a78438caef6b5746c1f51acaefab0dab08c39dcacf062960a7621447
7
- data.tar.gz: 845a18f4ace73dcb68ec98f1c7e6fc0afd6620f4d45f8f855777bf53671b1c12a0bcad3d29bbeb17a03a20f32428f944177619f3405ab0aae5cab8be4b512319