picky 4.6.3 → 4.6.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (55) hide show
  1. data/lib/performant.c +4 -4
  2. data/lib/picky/analyzer.rb +6 -3
  3. data/lib/picky/backends/backend.rb +40 -0
  4. data/lib/picky/backends/file/json.rb +4 -0
  5. data/lib/picky/backends/file.rb +1 -25
  6. data/lib/picky/backends/memory/json.rb +4 -0
  7. data/lib/picky/backends/memory.rb +1 -29
  8. data/lib/picky/backends/redis/directly_manipulable.rb +15 -7
  9. data/lib/picky/backends/redis.rb +91 -92
  10. data/lib/picky/backends/sqlite/basic.rb +6 -0
  11. data/lib/picky/bundle.rb +12 -10
  12. data/lib/picky/categories_indexing.rb +0 -13
  13. data/lib/picky/category.rb +24 -21
  14. data/lib/picky/category_indexing.rb +8 -22
  15. data/lib/picky/constants.rb +0 -1
  16. data/lib/picky/generators/aliases.rb +2 -0
  17. data/lib/picky/generators/partial.rb +27 -0
  18. data/lib/picky/generators/similarity.rb +27 -0
  19. data/lib/picky/generators/weights.rb +32 -0
  20. data/lib/picky/helpers/identification.rb +18 -0
  21. data/lib/picky/helpers/indexing.rb +16 -0
  22. data/lib/picky/index.rb +6 -0
  23. data/lib/picky/index_indexing.rb +9 -21
  24. data/lib/picky/indexes_indexing.rb +5 -14
  25. data/lib/picky/loader.rb +204 -199
  26. data/lib/picky/query/indexes.rb +12 -1
  27. data/lib/picky/search.rb +1 -0
  28. data/lib/picky/source.rb +23 -0
  29. data/lib/picky/tokenizer.rb +35 -13
  30. data/spec/functional/facets_spec.rb +1 -1
  31. data/spec/functional/remap_qualifiers_spec.rb +43 -0
  32. data/spec/functional/tokenizer_spec.rb +1 -1
  33. data/spec/lib/api/search/boost_spec.rb +1 -1
  34. data/spec/lib/category_spec.rb +1 -4
  35. data/spec/lib/generators/partial_spec.rb +58 -0
  36. data/spec/lib/generators/similarity_spec.rb +59 -0
  37. data/spec/lib/generators/weights_spec.rb +68 -0
  38. data/spec/lib/index_indexing_spec.rb +2 -4
  39. data/spec/lib/index_spec.rb +6 -0
  40. data/spec/lib/pool_spec.rb +39 -35
  41. data/spec/lib/sinatra_spec.rb +2 -2
  42. data/spec/lib/source_spec.rb +63 -0
  43. data/spec/lib/tokenizer_spec.rb +64 -2
  44. metadata +20 -20
  45. data/lib/picky/api/category/partial.rb +0 -26
  46. data/lib/picky/api/category/similarity.rb +0 -26
  47. data/lib/picky/api/category/weight.rb +0 -28
  48. data/lib/picky/api/source.rb +0 -35
  49. data/lib/picky/api/tokenizer.rb +0 -37
  50. data/lib/picky/deployment.rb +0 -211
  51. data/spec/lib/api/category/partial_spec.rb +0 -49
  52. data/spec/lib/api/category/similarity_spec.rb +0 -50
  53. data/spec/lib/api/category/weight_spec.rb +0 -55
  54. data/spec/lib/api/source_spec.rb +0 -68
  55. data/spec/lib/api/tokenizer_spec.rb +0 -42
data/lib/picky/loader.rb CHANGED
@@ -28,8 +28,10 @@ module Picky
28
28
 
29
29
  # Load a file relative to this.
30
30
  #
31
- def load_relative filename_without_rb
32
- Kernel.load File.join(File.dirname(__FILE__), "#{filename_without_rb}.rb")
31
+ def load_relative *filenames_without_rb
32
+ filenames_without_rb.each do |filename_without_rb|
33
+ Kernel.load File.join(File.dirname(__FILE__), "#{filename_without_rb}.rb")
34
+ end
33
35
  end
34
36
 
35
37
  # Load a user file.
@@ -46,231 +48,234 @@ module Picky
46
48
  exclaim "\nBy default, Picky needs/loads the PICKY_ROOT/app.rb file as the app.\n\n"
47
49
  raise e
48
50
  end
49
-
50
- # Loads the internal parts of the framework.
51
- # (Not for the user)
51
+
52
+ # Loads the compiled C code.
52
53
  #
53
- def load_framework_internals
54
- # Load compiled C code.
55
- #
56
- # Note: Picky already tries to compile
57
- # when installing the gem.
58
- #
54
+ # Note: Picky already tries to compile
55
+ # when installing the gem.
56
+ #
57
+ def load_c_code
59
58
  require_relative '../maybe_compile'
60
-
61
- # Load extensions.
62
- #
63
- load_relative 'extensions/object'
64
- load_relative 'extensions/array'
65
- load_relative 'extensions/symbol'
66
- load_relative 'extensions/string'
67
- load_relative 'extensions/module'
68
- load_relative 'extensions/class'
69
- load_relative 'extensions/hash'
70
-
71
- # Requiring Helpers
72
- #
73
- load_relative 'helpers/measuring'
74
- load_relative 'helpers/indexing'
75
-
76
- # Extension Modules
77
- #
78
- load_relative 'pool'
79
-
80
- # Calculations.
81
- #
82
- load_relative 'calculations/location'
83
-
84
- # Index generation strategies.
85
- #
86
- load_relative 'indexers/base'
87
- load_relative 'indexers/serial'
88
- load_relative 'indexers/parallel'
89
-
90
- # Generators.
91
- #
59
+ end
60
+ def load_extensions
61
+ load_relative 'extensions/object',
62
+ 'extensions/array',
63
+ 'extensions/symbol',
64
+ 'extensions/string',
65
+ 'extensions/module',
66
+ 'extensions/class',
67
+ 'extensions/hash'
68
+ end
69
+ def load_helpers
70
+ load_relative 'helpers/measuring',
71
+ 'helpers/indexing',
72
+ 'helpers/identification'
73
+ end
74
+ def load_index_generation_strategies
75
+ load_relative 'indexers/base',
76
+ 'indexers/serial',
77
+ 'indexers/parallel'
78
+
92
79
  load_relative 'generators/strategy'
93
-
80
+
94
81
  # Partial index generation strategies.
95
82
  #
96
- load_relative 'generators/partial/strategy'
97
- load_relative 'generators/partial/none'
98
- load_relative 'generators/partial/substring'
99
- load_relative 'generators/partial/postfix'
100
- load_relative 'generators/partial/infix'
101
- load_relative 'generators/partial/default'
102
-
83
+ load_relative 'generators/partial/strategy',
84
+ 'generators/partial/none',
85
+ 'generators/partial/substring',
86
+ 'generators/partial/postfix',
87
+ 'generators/partial/infix',
88
+ 'generators/partial/default'
89
+
103
90
  # Weight index generation strategies.
104
91
  #
105
- load_relative 'generators/weights/strategy'
106
- load_relative 'generators/weights/stub'
107
- load_relative 'generators/weights/dynamic'
108
- load_relative 'generators/weights/constant'
109
- load_relative 'generators/weights/logarithmic'
110
- load_relative 'generators/weights/default'
111
-
92
+ load_relative 'generators/weights/strategy',
93
+ 'generators/weights/stub',
94
+ 'generators/weights/dynamic',
95
+ 'generators/weights/constant',
96
+ 'generators/weights/logarithmic',
97
+ 'generators/weights/default'
98
+
112
99
  # Similarity index generation strategies.
113
100
  #
114
- load_relative 'generators/similarity/strategy'
115
- load_relative 'generators/similarity/none'
116
- load_relative 'generators/similarity/phonetic'
117
- load_relative 'generators/similarity/metaphone'
118
- load_relative 'generators/similarity/double_metaphone'
119
- load_relative 'generators/similarity/soundex'
120
- load_relative 'generators/similarity/default'
121
-
122
- # Index store handling.
123
- #
124
- load_relative 'backends/helpers/file'
125
- load_relative 'backends/backend'
101
+ load_relative 'generators/similarity/strategy',
102
+ 'generators/similarity/none',
103
+ 'generators/similarity/phonetic',
104
+ 'generators/similarity/metaphone',
105
+ 'generators/similarity/double_metaphone',
106
+ 'generators/similarity/soundex',
107
+ 'generators/similarity/default'
108
+ end
109
+
110
+ # Loads the index store handling.
111
+ #
112
+ def load_index_stores
113
+ load_relative 'backends/helpers/file',
114
+ 'backends/backend'
126
115
 
127
116
  load_relative 'backends/prepared/text'
128
117
 
129
- load_relative 'backends/memory'
130
- load_relative 'backends/memory/basic'
131
- load_relative 'backends/memory/marshal'
132
- load_relative 'backends/memory/json'
133
-
134
- load_relative 'backends/file'
135
- load_relative 'backends/file/basic'
136
- load_relative 'backends/file/json'
137
-
138
- load_relative 'backends/redis'
139
- load_relative 'backends/redis/directly_manipulable'
140
- load_relative 'backends/redis/basic'
141
- load_relative 'backends/redis/list'
142
- load_relative 'backends/redis/string'
143
- load_relative 'backends/redis/float'
144
-
145
- load_relative 'backends/sqlite'
146
- load_relative 'backends/sqlite/directly_manipulable'
147
- load_relative 'backends/sqlite/basic'
148
- load_relative 'backends/sqlite/array'
149
- load_relative 'backends/sqlite/value'
150
- load_relative 'backends/sqlite/string_key_array'
151
- load_relative 'backends/sqlite/integer_key_array'
152
-
153
- # Indexing and Indexed things.
154
- #
155
- load_relative 'bundle'
156
- load_relative 'bundle_indexing'
157
- load_relative 'bundle_indexed'
158
- load_relative 'bundle_realtime'
159
-
160
- # Wrappers.
161
- #
118
+ load_relative 'backends/memory',
119
+ 'backends/memory/basic',
120
+ 'backends/memory/marshal',
121
+ 'backends/memory/json'
122
+
123
+ load_relative 'backends/file',
124
+ 'backends/file/basic',
125
+ 'backends/file/json'
126
+
127
+ load_relative 'backends/redis',
128
+ 'backends/redis/directly_manipulable',
129
+ 'backends/redis/basic',
130
+ 'backends/redis/list',
131
+ 'backends/redis/string',
132
+ 'backends/redis/float'
133
+
134
+ load_relative 'backends/sqlite',
135
+ 'backends/sqlite/directly_manipulable',
136
+ 'backends/sqlite/basic',
137
+ 'backends/sqlite/array',
138
+ 'backends/sqlite/value',
139
+ 'backends/sqlite/string_key_array',
140
+ 'backends/sqlite/integer_key_array'
141
+ end
142
+
143
+ # Indexing and Indexed things.
144
+ #
145
+ def load_indexes
146
+ load_relative 'bundle',
147
+ 'bundle_indexing',
148
+ 'bundle_indexed',
149
+ 'bundle_realtime'
150
+ end
151
+
152
+ # Index wrappers.
153
+ #
154
+ def load_wrappers
162
155
  load_relative 'category/location'
163
156
 
164
- load_relative 'wrappers/bundle/delegators'
165
- load_relative 'wrappers/bundle/wrapper'
166
- load_relative 'wrappers/bundle/calculation'
167
- load_relative 'wrappers/bundle/location'
168
- load_relative 'wrappers/bundle/exact_partial'
169
-
170
- # Tokens.
171
- #
172
- load_relative 'query/token'
173
- load_relative 'query/tokens'
174
-
175
- # Query combinations, qualifiers, weigher.
176
- #
177
- load_relative 'query/combination'
178
- load_relative 'query/combinations'
157
+ load_relative 'wrappers/bundle/delegators',
158
+ 'wrappers/bundle/wrapper',
159
+ 'wrappers/bundle/calculation',
160
+ 'wrappers/bundle/location',
161
+ 'wrappers/bundle/exact_partial'
162
+ end
163
+
164
+ # Query combinations, qualifiers, weigher.
165
+ #
166
+ def load_query
167
+ load_relative 'query/combination',
168
+ 'query/combinations'
179
169
 
180
- load_relative 'query/allocation'
181
- load_relative 'query/allocations'
170
+ load_relative 'query/allocation',
171
+ 'query/allocations'
182
172
 
183
173
  load_relative 'query/qualifier_category_mapper'
184
174
 
185
175
  load_relative 'query/boosts'
186
176
 
187
- load_relative 'query/indexes'
188
- load_relative 'query/indexes_check'
177
+ load_relative 'query/indexes',
178
+ 'query/indexes_check'
179
+ end
180
+
181
+ # Loads the internal parts of the framework.
182
+ # (Not for the user)
183
+ #
184
+ def load_framework_internals
185
+ load_c_code
186
+ load_extensions
187
+ load_helpers
188
+ load_relative 'pool'
189
+ load_relative 'calculations/location' # Calculations
190
+ load_index_generation_strategies
191
+ load_index_stores
192
+ load_indexes
193
+ load_wrappers
194
+ load_relative 'query/token' # Token related.
195
+ load_relative 'query/tokens'
196
+ load_query
197
+ end
198
+
199
+ # All things API related.
200
+ #
201
+ def load_api
202
+ load_relative 'api/tokenizer/character_substituter',
203
+ 'api/search/boost'
204
+ end
205
+
206
+ def load_logging
207
+ load_relative 'loggers/silent',
208
+ 'loggers/concise',
209
+ 'loggers/verbose',
210
+ 'loggers/default'
211
+ end
212
+
213
+ def load_generators
214
+ load_relative 'generators/weights'
215
+ load_relative 'generators/partial'
216
+ load_relative 'generators/similarity'
217
+ load_relative 'generators/aliases'
218
+ end
219
+
220
+ def load_inner_api
221
+ load_relative 'category',
222
+ 'category_indexed',
223
+ 'category_indexing',
224
+ 'category_realtime',
225
+ 'category_convenience'
226
+
227
+ load_relative 'categories',
228
+ 'categories_indexed',
229
+ 'categories_indexing',
230
+ 'categories_realtime',
231
+ 'categories_convenience'
232
+
233
+ load_relative 'indexes',
234
+ 'indexes_indexed',
235
+ 'indexes_indexing',
236
+ 'indexes_convenience'
237
+
238
+ load_relative 'index',
239
+ 'index_indexed',
240
+ 'index_indexing',
241
+ 'index_realtime',
242
+ 'index_facets',
243
+ 'index_convenience'
244
+ end
245
+
246
+ def load_results
247
+ load_relative 'results',
248
+ 'results/exact_first'
189
249
  end
250
+
251
+ def load_search
252
+ load_relative 'search',
253
+ 'search_facets'
254
+ end
255
+
256
+ def load_interfaces
257
+ load_relative 'interfaces/live_parameters/master_child',
258
+ 'interfaces/live_parameters/unicorn'
259
+ end
260
+
190
261
  # Loads the user interface parts.
191
262
  #
263
+ # TODO Move tokenizer etc.?
264
+ #
192
265
  def load_user_interface
193
- # Load API parts.
194
- #
195
- load_relative 'api/tokenizer'
196
- load_relative 'api/tokenizer/character_substituter'
197
- load_relative 'api/source'
198
- load_relative 'api/category/weight'
199
- load_relative 'api/category/partial'
200
- load_relative 'api/category/similarity'
201
- load_relative 'api/search/boost'
202
-
203
- # Loggers.
204
- #
205
- load_relative 'loggers/silent'
206
- load_relative 'loggers/concise'
207
- load_relative 'loggers/verbose'
208
- load_relative 'loggers/default'
209
-
210
- # Tokenizer.
211
- #
266
+ load_api
267
+ load_logging
268
+ load_relative 'source'
212
269
  load_relative 'tokenizer'
213
-
214
- # Load harakiri.
215
- #
216
270
  load_relative 'rack/harakiri'
217
-
218
- # Character Substituters
219
- #
220
271
  load_relative 'character_substituters/west_european'
221
-
222
- # Convenience accessors for generators.
223
- #
224
- load_relative 'generators/aliases'
225
-
226
- # API.
227
- #
228
- load_relative 'category'
229
- load_relative 'category_indexed'
230
- load_relative 'category_indexing'
231
- load_relative 'category_realtime'
232
- load_relative 'category_convenience'
233
-
234
- load_relative 'categories'
235
- load_relative 'categories_indexed'
236
- load_relative 'categories_indexing'
237
- load_relative 'categories_realtime'
238
- load_relative 'categories_convenience'
239
-
240
- load_relative 'indexes'
241
- load_relative 'indexes_indexed'
242
- load_relative 'indexes_indexing'
243
- load_relative 'indexes_convenience'
244
-
245
- load_relative 'index'
246
- load_relative 'index_indexed'
247
- load_relative 'index_indexing'
248
- load_relative 'index_realtime'
249
- load_relative 'index_facets'
250
- load_relative 'index_convenience'
251
-
252
- # Results.
253
- #
254
- load_relative 'results'
255
- load_relative 'results/exact_first'
256
-
257
- # Search.
258
- #
259
- load_relative 'search'
260
- load_relative 'search_facets'
261
-
262
- # Interfaces
263
- #
264
- load_relative 'interfaces/live_parameters/master_child'
265
- load_relative 'interfaces/live_parameters/unicorn'
266
-
267
- # Load tools. Load specifically?
268
- #
272
+ load_generators
273
+ load_inner_api
274
+ load_results
275
+ load_search
276
+ load_interfaces
269
277
  load_relative 'scheduler'
270
-
271
- # Load migration notices.
272
- #
273
- load_relative 'migrations/from_30_to_31'
278
+ load_relative 'migrations/from_30_to_31' # TODO Remove.
274
279
  end
275
280
 
276
281
  # Loads the framework.
@@ -30,7 +30,18 @@ module Picky
30
30
 
31
31
  @indexes = indexes
32
32
 
33
- @mapper = QualifierCategoryMapper.new indexes # TODO Move into search?
33
+ remap_qualifiers
34
+ end
35
+
36
+ # Updates the qualifier ("qualifier:searchterm") mapping.
37
+ #
38
+ # Example:
39
+ # You dynamically add a new category to an index.
40
+ # To add the qualifiers to a search, you call this
41
+ # method.
42
+ #
43
+ def remap_qualifiers
44
+ @mapper = QualifierCategoryMapper.new @indexes # TODO Move into search?
34
45
  end
35
46
 
36
47
  # Ignore the categories with these qualifiers.
data/lib/picky/search.rb CHANGED
@@ -25,6 +25,7 @@ module Picky
25
25
 
26
26
  delegate :ignore,
27
27
  :only,
28
+ :remap_qualifiers,
28
29
  :to => :indexes
29
30
 
30
31
  # Takes:
@@ -0,0 +1,23 @@
1
+ module Picky
2
+
3
+ module Source
4
+ extend Helpers::Identification
5
+
6
+ # Either a thing responding to #each or a block is fine.
7
+ #
8
+ def self.from thing, nil_ok, index_name = nil
9
+ if thing.respond_to?(:each) || thing.respond_to?(:call)
10
+ thing
11
+ else
12
+ return if nil_ok
13
+
14
+ raise ArgumentError.new(<<-ERROR)
15
+ The source #{identifier_for(index_name)}should respond to either the method #each or
16
+ it can be a lambda/block, returning such a source.
17
+ ERROR
18
+ end
19
+ end
20
+
21
+ end
22
+
23
+ end
@@ -6,23 +6,41 @@ module Picky
6
6
  #
7
7
  class Tokenizer
8
8
 
9
- extend API::Tokenizer
10
-
9
+ extend Picky::Helpers::Identification
11
10
  include API::Tokenizer::CharacterSubstituter
12
11
 
13
12
  def self.default_indexing_with options = {}
14
- @indexing = extract_tokenizer options
13
+ @indexing = from options
15
14
  end
16
15
  def self.indexing
17
16
  @indexing ||= new
18
17
  end
19
18
 
20
19
  def self.default_searching_with options = {}
21
- @searching = extract_tokenizer options
20
+ @searching = from options
22
21
  end
23
22
  def self.searching
24
23
  @searching ||= new
25
24
  end
25
+
26
+ def self.from thing, index_name = nil, category_name = nil
27
+ return unless thing
28
+
29
+ if thing.respond_to? :tokenize
30
+ thing
31
+ else
32
+ if thing.respond_to? :[]
33
+ Picky::Tokenizer.new thing
34
+ else
35
+ raise <<-ERROR
36
+ indexing options #{identifier_for(index_name, category_name)}should be either
37
+ * a Hash
38
+ or
39
+ * an object that responds to #tokenize(text) => [[token1, token2, ...], [original1, original2, ...]]
40
+ ERROR
41
+ end
42
+ end
43
+ end
26
44
 
27
45
  def to_s
28
46
  reject_condition_location = @reject_condition.to_s[/:(\d+) \(lambda\)/, 1]
@@ -120,7 +138,7 @@ Case sensitive? #{@case_sensitive ? "Yes." : "-"}
120
138
 
121
139
  # Reject tokens after tokenizing based on the given criteria.
122
140
  #
123
- def rejects_token_if &condition
141
+ def rejects_token_if condition
124
142
  @reject_condition = condition
125
143
  end
126
144
  def reject tokens
@@ -161,14 +179,18 @@ Case sensitive? #{@case_sensitive ? "Yes." : "-"}
161
179
  alias substituter? substituter
162
180
 
163
181
  def initialize options = {}
164
- substitutes_characters_with options[:substitutes_characters_with] if options[:substitutes_characters_with]
165
- removes_characters options[:removes_characters] if options[:removes_characters]
166
- stopwords options[:stopwords] if options[:stopwords]
167
- splits_text_on options[:splits_text_on] || /\s/
168
- normalizes_words options[:normalizes_words] if options[:normalizes_words]
169
- max_words options[:max_words]
170
- rejects_token_if &(options[:rejects_token_if] || :blank?)
171
- case_sensitive options[:case_sensitive] unless options[:case_sensitive].nil?
182
+ options = default_options.merge options
183
+ options.each do |method_name, value|
184
+ send method_name, value unless value.nil?
185
+ end
186
+ rescue NoMethodError => e
187
+ raise %Q{The option "#{e.name}" is not a valid option for a Picky tokenizer.\nPlease see https://github.com/floere/picky/wiki/Indexing-configuration for valid options.}
188
+ end
189
+ def default_options
190
+ {
191
+ splits_text_on: /\s/,
192
+ rejects_token_if: :blank?.to_proc
193
+ }
172
194
  end
173
195
 
174
196
  # Returns a number of tokens, generated from the given text,
@@ -139,7 +139,7 @@ describe 'facets' do
139
139
  it 'is fast enough' do
140
140
  performance_of {
141
141
  10.times { finder.facets(:age_category, filter: 'surname:meier name:peter') }
142
- }.should < 0.00275
142
+ }.should < 0.003
143
143
  end
144
144
  it 'has one filtered facet' do
145
145
  # TODO Fix problems with alternative qualifiers (like :age).
@@ -0,0 +1,43 @@
1
+ # encoding: utf-8
2
+ #
3
+ require 'spec_helper'
4
+
5
+ describe 'qualifier remapping' do
6
+
7
+ it 'can have new qualifiers' do
8
+ index = Picky::Index.new :qualifier_remapping do
9
+ category :a
10
+ end
11
+
12
+ QualifierRemappingThing = Struct.new(:id, :a, :b)
13
+
14
+ index.add QualifierRemappingThing.new(1, "a", "b")
15
+
16
+ try = Picky::Search.new index
17
+
18
+ # Picky finds nothing.
19
+ #
20
+ try.search('b').ids.should == []
21
+
22
+ # Add a new category and a thing.
23
+ #
24
+ index.category :b
25
+ index.add QualifierRemappingThing.new(2, "c", "b")
26
+
27
+ # It finds it.
28
+ #
29
+ try.search('b').ids.should == [2]
30
+
31
+ # But not with qualifier!
32
+ #
33
+ try.search('b:b').ids.should == []
34
+
35
+ # So remap the qualifiers.
36
+ #
37
+ try.remap_qualifiers
38
+
39
+ # Now it works!
40
+ #
41
+ try.search('b:b').ids.should == [2]
42
+ end
43
+ end
@@ -5,7 +5,7 @@ require 'spec_helper'
5
5
  describe Picky::Tokenizer do
6
6
  describe 'examples' do
7
7
  it 'works correctly' do
8
- tokenizer = described_class.new(split_words_on: /\&/, normalizes_words: [[/\&/, 'and']])
8
+ tokenizer = described_class.new(normalizes_words: [[/\&/, 'and']])
9
9
 
10
10
  # Is this really correct? Shouldn't we split after normalizing?
11
11
  #
@@ -6,7 +6,7 @@ describe Picky::API::Search::Boost do
6
6
  include Picky::API::Search::Boost
7
7
  end.new
8
8
  end
9
- context 'extract_weight' do
9
+ context 'boost_for' do
10
10
  context 'with a Hash' do
11
11
  it 'returns a boosts object' do
12
12
  combinations = [
@@ -29,9 +29,6 @@ describe Picky::Category do
29
29
  it 'is correct' do
30
30
  category.prepared_index_path.should == 'spec/test_directory/index/test/some_index/some_category'
31
31
  end
32
- it 'is correct' do
33
- category.index_directory.should == 'spec/test_directory/index/test/some_index'
34
- end
35
32
  end
36
33
 
37
34
  context 'tokenizer' do
@@ -62,7 +59,7 @@ describe Picky::Category do
62
59
  indexing options for some_index:some_category should be either
63
60
  * a Hash
64
61
  or
65
- * an object that responds to #tokenize(text) => [[token1, ...], [original1, ...]]
62
+ * an object that responds to #tokenize(text) => [[token1, token2, ...], [original1, original2, ...]]
66
63
  ERROR
67
64
  end
68
65
  end