picky 4.19.1 → 4.19.2
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/picky/backends/backend.rb +0 -2
- data/lib/picky/bundle.rb +0 -2
- data/lib/picky/index.rb +2 -4
- data/lib/picky/query/allocation.rb +3 -3
- data/lib/picky/query/allocations.rb +2 -2
- data/lib/picky/query/indexes.rb +2 -2
- data/lib/picky/query/token.rb +2 -2
- data/lib/picky.rb +5 -1
- data/spec/lib/query/allocation_spec.rb +2 -2
- metadata +39 -22
- checksums.yaml +0 -7
data/lib/picky/bundle.rb
CHANGED
data/lib/picky/index.rb
CHANGED
@@ -297,9 +297,9 @@ module Picky
|
|
297
297
|
end
|
298
298
|
end
|
299
299
|
|
300
|
-
#
|
300
|
+
# Geo search, searches in a rectangle (almost square) in the lat/long coordinate system.
|
301
301
|
#
|
302
|
-
#
|
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
|
39
|
+
def calculate_score boosts
|
40
40
|
@score ||= if @combinations.empty?
|
41
41
|
0 # Optimization.
|
42
42
|
else
|
43
|
-
#
|
44
|
-
@combinations.score +
|
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
|
|
data/lib/picky/query/indexes.rb
CHANGED
@@ -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,
|
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
|
72
|
+
allocations.calculate_score boosts
|
73
73
|
|
74
74
|
# Filter the allocations – ignore/only.
|
75
75
|
#
|
data/lib/picky/query/token.rb
CHANGED
@@ -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
|
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
|
-
#
|
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
|
-
|
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
|
-
|
188
|
+
boosts = stub :weights, :boost_for => 2
|
189
189
|
|
190
|
-
@allocation.calculate_score(
|
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.
|
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-
|
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.
|
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.
|
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:
|
455
|
+
rubygems_version: 1.8.23
|
440
456
|
signing_key:
|
441
|
-
specification_version:
|
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
|