picky 3.6.16 → 4.0.0pre1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (73) hide show
  1. data/lib/picky/application.rb +1 -1
  2. data/lib/picky/backends/backend.rb +2 -0
  3. data/lib/picky/backends/memory.rb +14 -7
  4. data/lib/picky/backends/{memory → prepared}/text.rb +10 -4
  5. data/lib/picky/backends/redis/directly_manipulable.rb +3 -5
  6. data/lib/picky/backends/redis/list.rb +5 -1
  7. data/lib/picky/backends/sqlite/basic.rb +4 -2
  8. data/lib/picky/bundle.rb +6 -7
  9. data/lib/picky/bundle_indexed.rb +2 -2
  10. data/lib/picky/bundle_realtime.rb +8 -7
  11. data/lib/picky/categories.rb +0 -1
  12. data/lib/picky/categories_indexing.rb +14 -0
  13. data/lib/picky/category.rb +3 -5
  14. data/lib/picky/category_indexed.rb +2 -5
  15. data/lib/picky/category_indexing.rb +28 -16
  16. data/lib/picky/constants.rb +3 -1
  17. data/lib/picky/frontend_adapters/rack.rb +2 -2
  18. data/lib/picky/generators/similarity/phonetic.rb +6 -14
  19. data/lib/picky/generators/strategy.rb +1 -1
  20. data/lib/picky/generators/weights/runtime.rb +2 -2
  21. data/lib/picky/helpers/indexing.rb +20 -0
  22. data/lib/picky/index.rb +7 -10
  23. data/lib/picky/index_indexed.rb +1 -8
  24. data/lib/picky/index_indexing.rb +44 -42
  25. data/lib/picky/indexers/base.rb +5 -6
  26. data/lib/picky/indexers/parallel.rb +35 -32
  27. data/lib/picky/indexers/serial.rb +38 -15
  28. data/lib/picky/indexes_indexed.rb +0 -7
  29. data/lib/picky/indexes_indexing.rb +16 -19
  30. data/lib/picky/loader.rb +6 -4
  31. data/lib/picky/query/allocation.rb +7 -2
  32. data/lib/picky/query/combination.rb +1 -1
  33. data/lib/picky/query/indexes.rb +1 -1
  34. data/lib/picky/query/indexes_check.rb +12 -14
  35. data/lib/picky/query/token.rb +33 -15
  36. data/lib/picky/results/exact_first.rb +53 -0
  37. data/lib/picky/scheduler.rb +43 -0
  38. data/lib/picky/search.rb +0 -2
  39. data/lib/picky/sources/csv.rb +2 -3
  40. data/lib/picky/sources/db.rb +4 -3
  41. data/lib/picky/sources/mongo.rb +1 -1
  42. data/lib/picky/tokenizer.rb +0 -4
  43. data/lib/picky/wrappers/bundle/location.rb +1 -1
  44. data/lib/picky.rb +2 -2
  45. data/lib/tasks/index.rake +13 -14
  46. data/spec/functional/backends/file_spec.rb +2 -4
  47. data/spec/functional/backends/memory_spec.rb +2 -2
  48. data/spec/functional/backends/redis_spec.rb +1 -1
  49. data/spec/functional/exact_first_spec.rb +24 -4
  50. data/spec/functional/realtime_spec.rb +7 -3
  51. data/spec/lib/application_spec.rb +30 -30
  52. data/spec/lib/backends/backend_spec.rb +25 -27
  53. data/spec/lib/backends/{memory → prepared}/text_spec.rb +1 -1
  54. data/spec/lib/category_indexing_spec.rb +1 -1
  55. data/spec/lib/extensions/symbol_spec.rb +1 -1
  56. data/spec/lib/generators/similarity/phonetic_spec.rb +46 -0
  57. data/spec/lib/index_indexed_spec.rb +5 -5
  58. data/spec/lib/index_indexing_spec.rb +13 -12
  59. data/spec/lib/index_spec.rb +8 -8
  60. data/spec/lib/indexers/base_spec.rb +5 -6
  61. data/spec/lib/indexers/parallel_spec.rb +10 -10
  62. data/spec/lib/indexes_indexed_spec.rb +1 -7
  63. data/spec/lib/indexes_indexing_spec.rb +10 -5
  64. data/spec/lib/query/indexes_check_spec.rb +44 -15
  65. data/spec/lib/query/indexes_spec.rb +11 -11
  66. data/spec/lib/query/token_spec.rb +10 -0
  67. data/spec/lib/{indexed/wrappers → results}/exact_first_spec.rb +18 -21
  68. data/spec/lib/scheduler_spec.rb +92 -0
  69. metadata +45 -34
  70. data/lib/picky/cores.rb +0 -127
  71. data/lib/picky/tokenizers/location.rb +0 -53
  72. data/lib/picky/wrappers/category/exact_first.rb +0 -94
  73. data/spec/lib/cores_spec.rb +0 -185
metadata CHANGED
@@ -1,19 +1,19 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: picky
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.6.16
5
- prerelease:
4
+ version: 4.0.0pre1
5
+ prerelease: 5
6
6
  platform: ruby
7
7
  authors:
8
8
  - Florian Hanke
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2011-12-01 00:00:00.000000000 Z
12
+ date: 2011-12-06 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rspec
16
- requirement: &70259516646360 !ruby/object:Gem::Requirement
16
+ requirement: &70311745503320 !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: *70259516646360
24
+ version_requirements: *70311745503320
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: picky-client
27
- requirement: &70259516645760 !ruby/object:Gem::Requirement
27
+ requirement: &70311745502640 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ~>
31
31
  - !ruby/object:Gem::Version
32
- version: 3.6.16
32
+ version: 4.0.0pre1
33
33
  type: :development
34
34
  prerelease: false
35
- version_requirements: *70259516645760
35
+ version_requirements: *70311745502640
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: rack
38
- requirement: &70259516645320 !ruby/object:Gem::Requirement
38
+ requirement: &70311745502040 !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: *70259516645320
46
+ version_requirements: *70311745502040
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: rack_fast_escape
49
- requirement: &70259516644860 !ruby/object:Gem::Requirement
49
+ requirement: &70311745501280 !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: *70259516644860
57
+ version_requirements: *70311745501280
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: text
60
- requirement: &70259516644400 !ruby/object:Gem::Requirement
60
+ requirement: &70311745500860 !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: *70259516644400
68
+ version_requirements: *70311745500860
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: yajl-ruby
71
- requirement: &70259516643960 !ruby/object:Gem::Requirement
71
+ requirement: &70311745500360 !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: *70259516643960
79
+ version_requirements: *70311745500360
80
80
  - !ruby/object:Gem::Dependency
81
81
  name: activesupport
82
- requirement: &70259516659780 !ruby/object:Gem::Requirement
82
+ requirement: &70311745499600 !ruby/object:Gem::Requirement
83
83
  none: false
84
84
  requirements:
85
85
  - - ~>
@@ -87,10 +87,21 @@ dependencies:
87
87
  version: '3.0'
88
88
  type: :runtime
89
89
  prerelease: false
90
- version_requirements: *70259516659780
90
+ version_requirements: *70311745499600
91
+ - !ruby/object:Gem::Dependency
92
+ name: procrastinate
93
+ requirement: &70311745498920 !ruby/object:Gem::Requirement
94
+ none: false
95
+ requirements:
96
+ - - ~>
97
+ - !ruby/object:Gem::Version
98
+ version: '0.4'
99
+ type: :runtime
100
+ prerelease: false
101
+ version_requirements: *70311745498920
91
102
  - !ruby/object:Gem::Dependency
92
103
  name: unicorn
93
- requirement: &70259516659260 !ruby/object:Gem::Requirement
104
+ requirement: &70311745498540 !ruby/object:Gem::Requirement
94
105
  none: false
95
106
  requirements:
96
107
  - - ! '>='
@@ -98,10 +109,10 @@ dependencies:
98
109
  version: '0'
99
110
  type: :runtime
100
111
  prerelease: false
101
- version_requirements: *70259516659260
112
+ version_requirements: *70311745498540
102
113
  - !ruby/object:Gem::Dependency
103
114
  name: sinatra
104
- requirement: &70259516658620 !ruby/object:Gem::Requirement
115
+ requirement: &70311745498080 !ruby/object:Gem::Requirement
105
116
  none: false
106
117
  requirements:
107
118
  - - ! '>='
@@ -109,7 +120,7 @@ dependencies:
109
120
  version: '0'
110
121
  type: :runtime
111
122
  prerelease: false
112
- version_requirements: *70259516658620
123
+ version_requirements: *70311745498080
113
124
  description: Fast Ruby semantic text search engine with comfortable single field interface.
114
125
  email: florian.hanke+picky@gmail.com
115
126
  executables:
@@ -135,8 +146,8 @@ files:
135
146
  - lib/picky/backends/memory/basic.rb
136
147
  - lib/picky/backends/memory/json.rb
137
148
  - lib/picky/backends/memory/marshal.rb
138
- - lib/picky/backends/memory/text.rb
139
149
  - lib/picky/backends/memory.rb
150
+ - lib/picky/backends/prepared/text.rb
140
151
  - lib/picky/backends/redis/basic.rb
141
152
  - lib/picky/backends/redis/directly_manipulable.rb
142
153
  - lib/picky/backends/redis/float.rb
@@ -168,7 +179,6 @@ files:
168
179
  - lib/picky/character_substituters/west_european.rb
169
180
  - lib/picky/console.rb
170
181
  - lib/picky/constants.rb
171
- - lib/picky/cores.rb
172
182
  - lib/picky/deployment.rb
173
183
  - lib/picky/ext/maybe_compile.rb
174
184
  - lib/picky/ext/ruby19/extconf.rb
@@ -201,6 +211,7 @@ files:
201
211
  - lib/picky/generators/weights/logarithmic.rb
202
212
  - lib/picky/generators/weights/runtime.rb
203
213
  - lib/picky/generators/weights/strategy.rb
214
+ - lib/picky/helpers/indexing.rb
204
215
  - lib/picky/helpers/measuring.rb
205
216
  - lib/picky/index.rb
206
217
  - lib/picky/index_convenience.rb
@@ -229,7 +240,9 @@ files:
229
240
  - lib/picky/query/tokens.rb
230
241
  - lib/picky/query/weights.rb
231
242
  - lib/picky/rack/harakiri.rb
243
+ - lib/picky/results/exact_first.rb
232
244
  - lib/picky/results.rb
245
+ - lib/picky/scheduler.rb
233
246
  - lib/picky/search.rb
234
247
  - lib/picky/sinatra.rb
235
248
  - lib/picky/sources/base.rb
@@ -241,13 +254,11 @@ files:
241
254
  - lib/picky/statistics.rb
242
255
  - lib/picky/tasks.rb
243
256
  - lib/picky/tokenizer.rb
244
- - lib/picky/tokenizers/location.rb
245
257
  - lib/picky/wrappers/bundle/calculation.rb
246
258
  - lib/picky/wrappers/bundle/delegators.rb
247
259
  - lib/picky/wrappers/bundle/exact_partial.rb
248
260
  - lib/picky/wrappers/bundle/location.rb
249
261
  - lib/picky/wrappers/bundle/wrapper.rb
250
- - lib/picky/wrappers/category/exact_first.rb
251
262
  - lib/picky/wrappers/category/location.rb
252
263
  - lib/picky.rb
253
264
  - lib/tasks/try.rb
@@ -289,8 +300,8 @@ files:
289
300
  - spec/lib/backends/memory/basic_spec.rb
290
301
  - spec/lib/backends/memory/json_spec.rb
291
302
  - spec/lib/backends/memory/marshal_spec.rb
292
- - spec/lib/backends/memory/text_spec.rb
293
303
  - spec/lib/backends/memory_spec.rb
304
+ - spec/lib/backends/prepared/text_spec.rb
294
305
  - spec/lib/backends/redis/basic_spec.rb
295
306
  - spec/lib/backends/redis/directly_manipulable_spec.rb
296
307
  - spec/lib/backends/redis/float_spec.rb
@@ -309,7 +320,6 @@ files:
309
320
  - spec/lib/category_indexing_spec.rb
310
321
  - spec/lib/category_spec.rb
311
322
  - spec/lib/character_substituters/west_european_spec.rb
312
- - spec/lib/cores_spec.rb
313
323
  - spec/lib/extensions/array_spec.rb
314
324
  - spec/lib/extensions/hash_spec.rb
315
325
  - spec/lib/extensions/module_spec.rb
@@ -341,7 +351,6 @@ files:
341
351
  - spec/lib/indexed/bundle_spec.rb
342
352
  - spec/lib/indexed/wrappers/bundle/calculation_spec.rb
343
353
  - spec/lib/indexed/wrappers/bundle/wrapper_spec.rb
344
- - spec/lib/indexed/wrappers/exact_first_spec.rb
345
354
  - spec/lib/indexers/base_spec.rb
346
355
  - spec/lib/indexers/parallel_spec.rb
347
356
  - spec/lib/indexers/serial_spec.rb
@@ -365,7 +374,9 @@ files:
365
374
  - spec/lib/query/tokens_spec.rb
366
375
  - spec/lib/query/weights_spec.rb
367
376
  - spec/lib/rack/harakiri_spec.rb
377
+ - spec/lib/results/exact_first_spec.rb
368
378
  - spec/lib/results_spec.rb
379
+ - spec/lib/scheduler_spec.rb
369
380
  - spec/lib/search_spec.rb
370
381
  - spec/lib/sinatra_spec.rb
371
382
  - spec/lib/solr/schema_generator_spec.rb
@@ -394,9 +405,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
394
405
  required_rubygems_version: !ruby/object:Gem::Requirement
395
406
  none: false
396
407
  requirements:
397
- - - ! '>='
408
+ - - ! '>'
398
409
  - !ruby/object:Gem::Version
399
- version: '0'
410
+ version: 1.3.1
400
411
  requirements: []
401
412
  rubyforge_project: http://rubyforge.org/projects/picky
402
413
  rubygems_version: 1.8.11
@@ -433,8 +444,8 @@ test_files:
433
444
  - spec/lib/backends/memory/basic_spec.rb
434
445
  - spec/lib/backends/memory/json_spec.rb
435
446
  - spec/lib/backends/memory/marshal_spec.rb
436
- - spec/lib/backends/memory/text_spec.rb
437
447
  - spec/lib/backends/memory_spec.rb
448
+ - spec/lib/backends/prepared/text_spec.rb
438
449
  - spec/lib/backends/redis/basic_spec.rb
439
450
  - spec/lib/backends/redis/directly_manipulable_spec.rb
440
451
  - spec/lib/backends/redis/float_spec.rb
@@ -453,7 +464,6 @@ test_files:
453
464
  - spec/lib/category_indexing_spec.rb
454
465
  - spec/lib/category_spec.rb
455
466
  - spec/lib/character_substituters/west_european_spec.rb
456
- - spec/lib/cores_spec.rb
457
467
  - spec/lib/extensions/array_spec.rb
458
468
  - spec/lib/extensions/hash_spec.rb
459
469
  - spec/lib/extensions/module_spec.rb
@@ -485,7 +495,6 @@ test_files:
485
495
  - spec/lib/indexed/bundle_spec.rb
486
496
  - spec/lib/indexed/wrappers/bundle/calculation_spec.rb
487
497
  - spec/lib/indexed/wrappers/bundle/wrapper_spec.rb
488
- - spec/lib/indexed/wrappers/exact_first_spec.rb
489
498
  - spec/lib/indexers/base_spec.rb
490
499
  - spec/lib/indexers/parallel_spec.rb
491
500
  - spec/lib/indexers/serial_spec.rb
@@ -509,7 +518,9 @@ test_files:
509
518
  - spec/lib/query/tokens_spec.rb
510
519
  - spec/lib/query/weights_spec.rb
511
520
  - spec/lib/rack/harakiri_spec.rb
521
+ - spec/lib/results/exact_first_spec.rb
512
522
  - spec/lib/results_spec.rb
523
+ - spec/lib/scheduler_spec.rb
513
524
  - spec/lib/search_spec.rb
514
525
  - spec/lib/sinatra_spec.rb
515
526
  - spec/lib/solr/schema_generator_spec.rb
data/lib/picky/cores.rb DELETED
@@ -1,127 +0,0 @@
1
- module Picky
2
-
3
- Infinity = 1.0/0
4
-
5
- # Handles processing over multiple cores.
6
- #
7
- class Cores # :nodoc:all
8
-
9
- # Pass it an ary.
10
- #
11
- # ary = (1..10).to_a
12
- # forked ary, :max => 5 do |element|
13
- #
14
- # end
15
- #
16
- # Options include:
17
- # * max: Maximum # of processors to use. Default is all it can get.
18
- # * amount: An exactly defined amount of processors to use.
19
- # * randomly: Whether to use random order or not.
20
- #
21
- def self.forked elements, options = {}, &block
22
- return if elements.empty?
23
- raise "Block argument needed when running Cores.forked" unless block_given?
24
-
25
- # Note: Not using a generator because Enumerator#each
26
- # is exhibiting problems in some Rubies on some OSs
27
- # (see e.g. http://redmine.ruby-lang.org/issues/5003).
28
- #
29
- elements = elements.dup
30
- elements = elements.sort_by { rand } if options[:randomly]
31
-
32
- # Get the maximum number of processors.
33
- #
34
- max = max_processors options
35
-
36
- # Decide whether to use forking.
37
- #
38
- if fork?(max)
39
- processing = 0
40
-
41
- loop do
42
- while processing < max
43
- # Get the next element
44
- #
45
- element = elements.shift
46
- break unless element
47
- processing += 1
48
-
49
- # Fork and yield.
50
- #
51
- Process.fork do
52
- sleep 0.05*processing
53
- block.call element
54
- end
55
- end
56
-
57
- # Block and wait for any child to finish.
58
- #
59
- begin
60
- Process.wait 0
61
- rescue Errno::ECHILD => e
62
- break
63
- ensure
64
- processing -= 1
65
- end
66
- end
67
- else
68
- elements.each &block
69
- end
70
-
71
- end
72
-
73
- # Do not fork if there is just one processor,
74
- # or as in Windows, if there isn't the
75
- # possibility of forking.
76
- #
77
- def self.fork? max_processors
78
- max_processors > 1 && Process.respond_to?(:fork)
79
- end
80
-
81
- # Return the number of maximum usable processors.
82
- #
83
- # Options
84
- # max: The maximum amount of cores used.
85
- #
86
- def self.max_processors options = {}
87
- options[:amount] || [number_of_cores, (options[:max] || Infinity)].min
88
- end
89
-
90
- # Gets the number of cores depending on OS.
91
- #
92
- def self.number_of_cores
93
- extract_cores_for actual_platform
94
- end
95
- # Extracts the platform os from the platform.
96
- #
97
- # Note: Could also use 'rbconfig'.
98
- #
99
- def self.actual_platform
100
- matched = platform.match(/-\b([a-z]*)/)
101
- matched && matched[1]
102
- end
103
- # Returns a mapping
104
- # os_name => lambda_which_returns_a_number_of_cores
105
- #
106
- @@number_of_cores = {
107
- 'darwin' => lambda { `system_profiler SPHardwareDataType | grep -i 'Total Number [oO]f Cores'`.gsub(/[^\d]/, '') },
108
- 'linux' => lambda { `grep -ci ^processor /proc/cpuinfo` }
109
- }
110
- def self.os_to_core_mapping
111
- @@number_of_cores
112
- end
113
- # Extracts the number of cores for the given os name.
114
- #
115
- # Note: Default is 1.
116
- #
117
- def self.extract_cores_for os
118
- code_to_execute = os_to_core_mapping[os]
119
- code_to_execute && code_to_execute.call.to_i || 1
120
- end
121
- def self.platform
122
- RUBY_PLATFORM
123
- end
124
-
125
- end
126
-
127
- end
@@ -1,53 +0,0 @@
1
- module Picky
2
-
3
- module Tokenizers
4
-
5
- class Location < Picky::Tokenizer # TODO Still needed?
6
-
7
- attr_reader :calculation
8
-
9
- def initialize options = {}
10
- super options
11
-
12
- grid = options[:grid]
13
- precision = options[:precision] || 1
14
-
15
- @calculation = Calculations::Location.new grid, precision
16
-
17
- @minimum = 1.0 / 0
18
-
19
- @locations = []
20
- end
21
-
22
- #
23
- #
24
- def tokenize text
25
-
26
- # Gather min/max.
27
- #
28
- source.harvest category do |indexed_id, location|
29
- location = location.to_f
30
- minimum = location if location < minimum
31
- locations << [indexed_id, location]
32
- end
33
-
34
- calculation.minimum = minimum
35
-
36
- # Recalculate locations.
37
- #
38
- locations.each do |indexed_id, location|
39
- calculation.recalculated_range(location).each do |new_location|
40
- yield indexed_id, new_location.to_s
41
- end
42
- end
43
-
44
- # TODO Move to the right place.
45
- #
46
- category.exact[:location_minimum] = minimum
47
- end
48
-
49
- end
50
-
51
- end
52
-
53
- end
@@ -1,94 +0,0 @@
1
- # encoding: utf-8
2
- #
3
- module Picky
4
-
5
- module Wrappers
6
-
7
- module Category
8
-
9
- # This index combines an exact and partial index.
10
- # It serves to order the results such that exact hits are found first.
11
- #
12
- class ExactFirst
13
-
14
- # TODO Refactor!
15
- #
16
- delegate :add,
17
- :qualifiers,
18
- :exact,
19
- :partial,
20
- :replace,
21
-
22
- :identifier,
23
- :name,
24
-
25
- :index,
26
- :category,
27
- :dump,
28
- :load,
29
-
30
- :empty,
31
- :prepared_index_file,
32
- :tokenizer,
33
- :cache,
34
- :from,
35
-
36
- :bundle_for,
37
- :build_realtime_mapping,
38
-
39
- :to => :@category
40
-
41
- def initialize category
42
- @category = category
43
- @exact = category.exact
44
- @partial = category.partial
45
- end
46
-
47
- def self.wrap index_or_category
48
- if index_or_category.respond_to? :categories
49
- wrap_each_of index_or_category.categories
50
- index_or_category
51
- else
52
- new index_or_category
53
- end
54
- end
55
- def self.wrap_each_of categories
56
- actual_categories = categories.categories
57
- categories.clear_categories
58
-
59
- actual_categories.each do |category|
60
- categories << new(category)
61
- end
62
- end
63
-
64
- def ids token
65
- text = token.text
66
- if token.partial?
67
- @exact.ids(text) | @partial.ids(text)
68
- else
69
- @exact.ids text
70
- end
71
- end
72
-
73
- def weight token
74
- text = token.text
75
- if token.partial?
76
- [@exact.weight(text), @partial.weight(text)].compact.max
77
- else
78
- @exact.weight text
79
- end
80
- end
81
-
82
- # TODO Refactor! (Subclass Picky::Category?)
83
- #
84
- def combination_for token
85
- weight(token) && Query::Combination.new(token, self)
86
- end
87
-
88
- end
89
-
90
- end
91
-
92
- end
93
-
94
- end