picky 0.10.5 → 0.11.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (52) hide show
  1. data/lib/picky/alias_instances.rb +1 -0
  2. data/lib/picky/application.rb +6 -7
  3. data/lib/picky/bundle.rb +31 -0
  4. data/lib/picky/configuration/indexes.rb +30 -41
  5. data/lib/picky/configuration/type.rb +6 -40
  6. data/lib/picky/ext/maybe_compile.rb +9 -0
  7. data/lib/picky/index/bundle.rb +1 -139
  8. data/lib/picky/{query/combinator.rb → index/categories.rb} +16 -18
  9. data/lib/picky/index/category.rb +20 -46
  10. data/lib/picky/index/type.rb +16 -12
  11. data/lib/picky/index/types.rb +41 -0
  12. data/lib/picky/index/wrappers/exact_first.rb +5 -1
  13. data/lib/picky/indexers/base.rb +9 -8
  14. data/lib/picky/indexing/bundle.rb +152 -0
  15. data/lib/picky/indexing/categories.rb +36 -0
  16. data/lib/picky/indexing/category.rb +145 -0
  17. data/lib/picky/indexing/type.rb +45 -0
  18. data/lib/picky/indexing/types.rb +74 -0
  19. data/lib/picky/loader.rb +17 -7
  20. data/lib/picky/query/base.rb +5 -4
  21. data/lib/picky/sources/wrappers/base.rb +23 -0
  22. data/lib/picky/sources/wrappers/location.rb +92 -0
  23. data/lib/picky/tokenizers/index.rb +4 -1
  24. data/lib/picky/type.rb +46 -0
  25. data/lib/picky/types.rb +38 -0
  26. data/lib/tasks/index.rake +4 -0
  27. data/project_prototype/Gemfile +1 -1
  28. data/project_prototype/app/application.rb +12 -12
  29. data/spec/lib/application_spec.rb +6 -9
  30. data/spec/lib/configuration/indexes_spec.rb +0 -85
  31. data/spec/lib/index/bundle_spec.rb +2 -94
  32. data/spec/lib/index/category_spec.rb +7 -86
  33. data/spec/lib/index/type_spec.rb +14 -26
  34. data/spec/lib/index/wrappers/exact_first_spec.rb +12 -12
  35. data/spec/lib/{index → indexing}/bundle_partial_generation_speed_spec.rb +2 -2
  36. data/spec/lib/indexing/bundle_spec.rb +174 -0
  37. data/spec/lib/{query/combinator_spec.rb → indexing/categories_spec.rb} +30 -34
  38. data/spec/lib/indexing/category_spec.rb +257 -0
  39. data/spec/lib/indexing/type_spec.rb +32 -0
  40. data/spec/lib/loader_spec.rb +0 -2
  41. data/spec/lib/query/base_spec.rb +8 -17
  42. data/spec/lib/query/full_spec.rb +3 -6
  43. data/spec/lib/query/live_spec.rb +4 -3
  44. data/spec/lib/sources/wrappers/base_spec.rb +35 -0
  45. data/spec/lib/sources/wrappers/location_spec.rb +68 -0
  46. data/spec/lib/tokenizers/index_spec.rb +2 -5
  47. metadata +32 -16
  48. data/lib/picky/configuration/field.rb +0 -73
  49. data/lib/picky/indexes.rb +0 -179
  50. data/lib/picky/initializers/ext.rb +0 -1
  51. data/spec/lib/configuration/field_spec.rb +0 -208
  52. data/spec/lib/configuration/type_spec.rb +0 -49
@@ -61,8 +61,11 @@ module Tokenizers
61
61
  #
62
62
  # Override in subclasses to redefine behaviour.
63
63
  #
64
+ # TODO Make parametrizable! reject { |token| }
65
+ #
64
66
  def reject tokens
65
- tokens.reject! { |token| token.to_s.size < 2 }
67
+ tokens.reject! &:blank?
68
+ # tokens.reject! { |token| token.to_s.size < 2 }
66
69
  end
67
70
 
68
71
  end
data/lib/picky/type.rb ADDED
@@ -0,0 +1,46 @@
1
+ # This class defines the indexing and index API.
2
+ #
3
+ # Note: A Type holds both an Index::Type and an Indexing::Type.
4
+ #
5
+ class Type
6
+
7
+ # TODO Delegation.
8
+ #
9
+
10
+ attr_reader :name, :indexing, :index
11
+
12
+ def initialize name, source, options = {}
13
+ @name = name
14
+ @indexing = Indexing::Type.new name, source, options
15
+ @index = Index::Type.new name, options
16
+
17
+ # Centralized registry.
18
+ #
19
+ ::Indexes.register self
20
+ end
21
+
22
+ # API.
23
+ #
24
+ # TODO Spec! Doc!
25
+ #
26
+ def category name, options = {}
27
+ name = name.to_sym
28
+
29
+ indexing.add_category name, options
30
+ index.add_category name, options
31
+
32
+ self
33
+ end
34
+ # def location name, options = {}
35
+ # grid = options.delete :grid
36
+ # precision = options.delete :precision
37
+ #
38
+ # options[:index_tokenizer] ||= Tokenizers::Index.new # TODO Or a specific location tokenizer.
39
+ # options[:query_tokenizer] ||= Tokenizers::Query.new # TODO Or a specific location tokenizer.
40
+ # options[:source_wrapper] ||= Sources::Wrappers::Location.new(options)
41
+ #
42
+ # new_category = category name, options
43
+ # :source => Sources::Wrappers::Location.new(source, grid:2), :tokenizer => Tokenizers::Index.new
44
+ # end
45
+
46
+ end
@@ -0,0 +1,38 @@
1
+ # Comfortable API convenience class, splits methods to indexes.
2
+ #
3
+ class Types
4
+
5
+ attr_reader :types, :type_mapping
6
+
7
+ delegate :reload,
8
+ :load_from_cache,
9
+ :to => :@indexes
10
+
11
+ delegate :index,
12
+ :generate_index_only,
13
+ :generate_cache_only,
14
+ :to => :@indexings
15
+
16
+ def initialize
17
+ @types = []
18
+ @type_mapping = {}
19
+
20
+ @indexes = Index::Types.new
21
+ @indexings = Indexing::Types.new
22
+ end
23
+
24
+ def register type
25
+ self.types << type
26
+ self.type_mapping[type.name] = type
27
+
28
+ @indexings.register type.indexing
29
+ @indexes.register type.index # TODO Even necessary?
30
+ end
31
+
32
+ def [] name
33
+ name = name.to_sym
34
+
35
+ self.type_mapping[name]
36
+ end
37
+
38
+ end
data/lib/tasks/index.rake CHANGED
@@ -12,6 +12,10 @@ namespace :index do
12
12
  # end
13
13
  # end
14
14
 
15
+ # TODO Make option to also use non-random.
16
+ # rake index:randomly (default)
17
+ # rake index:ordered
18
+ #
15
19
  desc "Takes a snapshot, indexes, and caches."
16
20
  task :generate, [:order] => :application do |_, options|
17
21
  randomly = (options.order == 'ordered') ? false : true
@@ -2,7 +2,7 @@ source :gemcutter
2
2
 
3
3
  # Gems required by Picky.
4
4
  #
5
- gem 'picky', '~> 0.10.0'
5
+ gem 'picky', '~> 0.11.0'
6
6
  gem 'rake'
7
7
  gem 'bundler'
8
8
  gem 'rack', '~> 1.2.1'
@@ -22,19 +22,19 @@ class PickySearch < Application
22
22
  maximum_tokens: 5, # Max amount of tokens passing into a query. 5 is the default.
23
23
  substitutes_characters_with: CharacterSubstitution::European.new # Normalizes special user input, Ä -> Ae, ñ -> n etc.
24
24
 
25
- # Define an index. Use a database etc. source? http://github.com/floere/picky/wiki/Sources-Configuration#sources
25
+ # Define an index. Use a database etc. source?
26
+ # See http://github.com/floere/picky/wiki/Sources-Configuration#sources
26
27
  #
27
- books_index = index :books,
28
- Sources::CSV.new(:title, :author, :isbn, :year, :publisher, :subjects, file: 'app/library.csv'),
29
- category(:title,
30
- similarity: Similarity::Phonetic.new(3), # Up to three similar title word indexed (default: No similarity).
31
- partial: Partial::Substring.new(from: 1)), # Indexes substrings upwards from character 1 (default: -3),
32
- # You'll find "picky" even when entering just a "p".
33
- category(:author,
34
- partial: Partial::Substring.new(from: 1)),
35
- category(:isbn,
36
- partial: Partial::None.new) # Partial substring searching on an ISBN does not make
37
- # much sense, neither does similarity.
28
+ books_index = index :books, Sources::CSV.new(:title, :author, :isbn, file: 'app/library.csv')
29
+ books_index.category :title,
30
+ similarity: Similarity::Phonetic.new(3), # Up to three similar title word indexed (default: No similarity).
31
+ partial: Partial::Substring.new(from: 1) # Indexes substrings upwards from character 1 (default: -3),
32
+ # You'll find "picky" even when entering just a "p".
33
+ books_index.category :author,
34
+ partial: Partial::Substring.new(from: 1)
35
+ books_index.category :isbn,
36
+ partial: Partial::None.new # Partial substring searching on an ISBN does not make
37
+ # much sense, neither does similarity.
38
38
 
39
39
  query_options = { :weights => { [:title, :author] => +3, [:title] => +1 } } # +/- points for ordered combinations.
40
40
 
@@ -8,9 +8,8 @@ describe Application do
8
8
  it "should run ok" do
9
9
  lambda {
10
10
  class MinimalTestApplication < Application
11
- books = index :books,
12
- Sources::DB.new('SELECT id, title FROM books', :file => 'app/db.yml'),
13
- category(:title)
11
+ books = index :books, Sources::DB.new('SELECT id, title FROM books', :file => 'app/db.yml')
12
+ books.category :title
14
13
 
15
14
 
16
15
  full = Query::Full.new books
@@ -42,12 +41,10 @@ describe Application do
42
41
  substitutes_characters_with: CharacterSubstitution::European.new,
43
42
  maximum_tokens: 5
44
43
 
45
- books_index = index :books,
46
- Sources::DB.new('SELECT id, title, author, isbn13 as isbn FROM books', :file => 'app/db.yml'),
47
- category(:title, :similarity => Similarity::DoubleLevenshtone.new(3)), # Up to three similar title word indexed.
48
- category(:author),
49
- category(:isbn, :partial => Partial::None.new) # Partially searching on an ISBN makes not much sense.
50
-
44
+ books_index = index :books, Sources::DB.new('SELECT id, title, author, isbn13 as isbn FROM books', :file => 'app/db.yml')
45
+ books_index.category :title, similarity: Similarity::DoubleLevenshtone.new(3) # Up to three similar title word indexed.
46
+ books_index.category :author
47
+ books_index.category :isbn, partial: Partial::None.new # Partially searching on an ISBN makes not much sense.
51
48
 
52
49
  full = Query::Full.new books_index
53
50
  live = Query::Live.new books_index
@@ -25,89 +25,4 @@ describe Configuration::Indexes do
25
25
  end
26
26
  end
27
27
 
28
- describe "take_snapshot" do
29
- before(:each) do
30
- @type1 = stub :type, :name => :type1
31
- @type2 = stub :type, :name => :type2
32
-
33
- @config.stub! :types => [@type1, @type2]
34
- end
35
- it "tells type to make a snapshot" do
36
- @type2.should_receive(:take_snapshot).once.with
37
-
38
- @config.take_snapshot :type2
39
- end
40
- end
41
- describe "index" do
42
- before(:each) do
43
- @type1 = stub :type, :name => :type1
44
- @type2 = stub :type, :name => :type2
45
-
46
- @config.stub! :types => [@type1, @type2]
47
- end
48
- it "tells type to index" do
49
- @type2.should_receive(:index).once.with
50
-
51
- @config.index :type2
52
- end
53
- end
54
- describe "index_solr" do
55
- before(:each) do
56
- @type1 = stub :type, :name => :type1
57
- @type2 = stub :type, :name => :type2
58
-
59
- @config.stub! :types => [@type1, @type2]
60
- end
61
- it "tells type to index_solr" do
62
- @type2.should_receive(:index_solr).once.with
63
-
64
- @config.index_solr :type2
65
- end
66
- end
67
-
68
- describe "only_if_included_in" do
69
- before(:each) do
70
- type1 = stub :type, :name => :type1
71
- type2 = stub :type, :name => :type2
72
-
73
- @config.stub! :types => [type1, type2]
74
- end
75
- context "without type names" do
76
- it "calls the block" do
77
- checker = stub :checker
78
- checker.should_receive(:bla).twice
79
-
80
- @config.only_if_included_in do |type|
81
- checker.bla
82
- end
83
- end
84
- it "calls the block" do
85
- checker = stub :checker
86
- checker.should_receive(:bla).twice
87
-
88
- @config.only_if_included_in [] do |type|
89
- checker.bla
90
- end
91
- end
92
- end
93
- context "with type names" do
94
- it "is included" do
95
- checker = stub :checker
96
- checker.should_receive(:bla).once
97
-
98
- @config.only_if_included_in [:type2, :type3, :type4] do |type|
99
- checker.bla
100
- end
101
- end
102
- it "is not included" do
103
- checker = stub :checker
104
- checker.should_receive(:bla).never
105
-
106
- @config.only_if_included_in [:type3, :type4, :type5] do |type|
107
- checker.bla
108
- end
109
- end
110
- end
111
- end
112
-
113
28
  end
@@ -5,11 +5,9 @@ describe Index::Bundle do
5
5
  before(:each) do
6
6
  @category = stub :category, :name => :some_category
7
7
  @type = stub :type, :name => :some_type
8
- @partial = stub :partial
9
- @weights = stub :weights
10
8
  @similarity = stub :similarity
11
9
  @index_class = Index::Bundle
12
- @index = @index_class.new :some_name, @category, @type, @partial, @weights, @similarity
10
+ @index = @index_class.new :some_name, @category, @type, @similarity
13
11
  end
14
12
 
15
13
  describe 'identifier' do
@@ -63,33 +61,6 @@ describe Index::Bundle do
63
61
  end
64
62
  end
65
63
 
66
- describe 'generate_derived' do
67
- it 'should call two methods in order' do
68
- @index.should_receive(:generate_weights).once.ordered
69
- @index.should_receive(:generate_similarity).once.ordered
70
-
71
- @index.generate_derived
72
- end
73
- end
74
-
75
- describe 'generate_caches_from_memory' do
76
- it 'should call two methods in order' do
77
- @index.should_receive(:cache_from_memory_generation_message).once.ordered
78
- @index.should_receive(:generate_derived).once.ordered
79
-
80
- @index.generate_caches_from_memory
81
- end
82
- end
83
-
84
- describe 'generate_caches_from_source' do
85
- it 'should call two methods in order' do
86
- @index.should_receive(:load_from_index_file).once.ordered
87
- @index.should_receive(:generate_caches_from_memory).once.ordered
88
-
89
- @index.generate_caches_from_source
90
- end
91
- end
92
-
93
64
  describe 'ids' do
94
65
  before(:each) do
95
66
  @index.instance_variable_set :@index, { :existing => :some_ids }
@@ -156,66 +127,12 @@ describe Index::Bundle do
156
127
  end
157
128
  end
158
129
 
159
- describe 'dump' do
160
- it 'should trigger dumps' do
161
- @index.should_receive(:dump_index).once.with
162
- @index.should_receive(:dump_similarity).once.with
163
- @index.should_receive(:dump_weights).once.with
164
-
165
- @index.dump
166
- end
167
- end
168
-
169
- describe 'raise_unless_cache_exists' do
170
- before(:each) do
171
- @files = stub :files
172
- @files.stub! :index_cache_ok? => true
173
- @files.stub! :similarity_cache_ok? => true
174
- @files.stub! :weights_cache_ok? => true
175
- @files.stub! :index_cache_small? => false
176
- @files.stub! :similarity_cache_small? => false
177
- @files.stub! :weights_cache_small? => false
178
-
179
- @index.stub! :files => @files
180
- end
181
- context 'weights cache missing' do
182
- before(:each) do
183
- @files.stub! :weights_cache_ok? => false
184
- end
185
- it 'should raise' do
186
- lambda do
187
- @index.raise_unless_cache_exists
188
- end.should raise_error("weights cache for some_name: some_type some_category missing.")
189
- end
190
- end
191
- context 'similarity cache missing' do
192
- before(:each) do
193
- @files.stub! :similarity_cache_ok? => false
194
- end
195
- it 'should raise' do
196
- lambda do
197
- @index.raise_unless_cache_exists
198
- end.should raise_error("similarity cache for some_name: some_type some_category missing.")
199
- end
200
- end
201
- context 'index cache missing' do
202
- before(:each) do
203
- @files.stub! :index_cache_ok? => false
204
- end
205
- it 'should raise' do
206
- lambda do
207
- @index.raise_unless_cache_exists
208
- end.should raise_error("index cache for some_name: some_type some_category missing.")
209
- end
210
- end
211
- end
212
-
213
130
  describe 'initialization' do
214
131
  before(:each) do
215
132
  @category = stub :category, :name => :some_category
216
133
  @type = stub :type, :name => :some_type
217
134
 
218
- @index = @index_class.new :some_name, @category, @type, :partial, :weights, :similarity
135
+ @index = @index_class.new :some_name, @category, @type, :similarity
219
136
  end
220
137
  it 'should initialize the index correctly' do
221
138
  @index.index.should == {}
@@ -226,15 +143,6 @@ describe Index::Bundle do
226
143
  it 'should initialize the similarity index correctly' do
227
144
  @index.similarity.should == {}
228
145
  end
229
- it 'should initialize the name correctly' do
230
- @index.category.should == @category
231
- end
232
- it 'should initialize the partial strategy correctly' do
233
- @index.partial_strategy.should == :partial
234
- end
235
- it 'should initialize the weights strategy correctly' do
236
- @index.weights_strategy.should == :weights
237
- end
238
146
  it 'should initialize the similarity strategy correctly' do
239
147
  @index.similarity_strategy.should == :similarity
240
148
  end
@@ -3,60 +3,23 @@ require 'spec_helper'
3
3
  describe Index::Category do
4
4
 
5
5
  before(:each) do
6
- @field = stub :field, :name => :some_name
7
6
  @type = stub :type, :name => :some_type
8
7
  @partial = stub :partial
9
8
  @weights = stub :weights
10
9
  @similarity = stub :similarity
11
- @category = Index::Category.new @field, @type, :partial => @partial, :weights => @weights, :similarity => @similarity
12
-
10
+ @category = Index::Category.new :some_name, @type, :partial => @partial,
11
+ :weights => @weights,
12
+ :similarity => @similarity,
13
+ :qualifiers => [:q, :qualifier]
14
+
13
15
  @exact = stub :exact, :dump => nil
14
16
  @category.stub! :exact => @exact
15
-
17
+
16
18
  @partial = stub :partial, :dump => nil
17
19
  @category.stub! :partial => @partial
18
20
  @category.stub! :exclaim
19
21
  end
20
-
21
- describe 'dump_caches' do
22
- it 'should dump the exact index' do
23
- @exact.should_receive(:dump).once.with
24
-
25
- @category.dump_caches
26
- end
27
- it 'should dump the partial index' do
28
- @partial.should_receive(:dump).once.with
29
-
30
- @category.dump_caches
31
- end
32
- end
33
-
34
- describe 'generate_derived_partial' do
35
- it 'should delegate to partial' do
36
- @partial.should_receive(:generate_derived).once.with
37
-
38
- @category.generate_derived_partial
39
- end
40
- end
41
-
42
- describe 'generate_derived_exact' do
43
- it 'should delegate to exact' do
44
- @exact.should_receive(:generate_derived).once.with
45
-
46
- @category.generate_derived_exact
47
- end
48
- end
49
-
50
- describe 'generate_indexes_from_exact_index' do
51
- it 'should call three method in order' do
52
- @category.should_receive(:generate_derived_exact).once.with().ordered
53
- @category.should_receive(:generate_partial).once.with().ordered
54
- @category.should_receive(:generate_derived_partial).once.with().ordered
55
-
56
- @category.generate_indexes_from_exact_index
57
- end
58
- end
59
-
22
+
60
23
  describe 'weight' do
61
24
  before(:each) do
62
25
  @token = stub :token, :text => :some_text
@@ -146,48 +109,6 @@ describe Index::Category do
146
109
  @category.bundle_for(token).should == @partial
147
110
  end
148
111
  end
149
-
150
- describe 'generate_caches_from_memory' do
151
- it 'should delegate to partial' do
152
- @partial.should_receive(:generate_caches_from_memory).once.with
153
-
154
- @category.generate_caches_from_memory
155
- end
156
- end
157
-
158
- describe 'generate_partial' do
159
- it 'should return whatever the partial generation returns' do
160
- @exact.stub! :index
161
- @partial.stub! :generate_partial_from => :generation_returns
162
-
163
- @category.generate_partial
164
- end
165
- it 'should use the exact index to generate the partial index' do
166
- exact_index = stub :exact_index
167
- @exact.stub! :index => exact_index
168
- @partial.should_receive(:generate_partial_from).once.with(exact_index)
169
-
170
- @category.generate_partial
171
- end
172
- end
173
-
174
- describe 'generate_caches_from_source' do
175
- it 'should delegate to exact' do
176
- @exact.should_receive(:generate_caches_from_source).once.with
177
-
178
- @category.generate_caches_from_source
179
- end
180
- end
181
-
182
- describe 'generate_caches' do
183
- it 'should call three method in order' do
184
- @category.should_receive(:generate_caches_from_source).once.with().ordered
185
- @category.should_receive(:generate_partial).once.with().ordered
186
- @category.should_receive(:generate_caches_from_memory).once.with().ordered
187
-
188
- @category.generate_caches
189
- end
190
- end
191
112
 
192
113
  describe 'load_from_cache' do
193
114
  it 'should call two methods' do
@@ -4,47 +4,35 @@ describe Index::Type do
4
4
 
5
5
  context "with categories" do
6
6
  before(:each) do
7
- @some_type1 = stub :some_type1, :name => :some_type1
8
- @some_type2 = stub :some_type2, :name => :some_type2
7
+ @categories = stub :categories
9
8
 
10
- @category1 = Index::Category.new :some_category_name1, @some_type1
11
- @category2 = Index::Category.new :some_category_name2, @some_type2
9
+ @index = Index::Type.new :some_name
10
+ @index.add_category :some_category_name1
11
+ @index.add_category :some_category_name2
12
12
 
13
- @index = Index::Type.new :some_name, :some_result_type, false, @category1, @category2
14
- end
15
- describe "generate_caches" do
16
- it "delegates to each category" do
17
- @category1.should_receive(:generate_caches).once.with
18
- @category2.should_receive(:generate_caches).once.with
19
-
20
- @index.generate_caches
21
- end
13
+ @index.stub! :categories => @categories
22
14
  end
15
+
23
16
  describe "load_from_cache" do
24
17
  it "delegates to each category" do
25
- @category1.should_receive(:load_from_cache).once.with
26
- @category2.should_receive(:load_from_cache).once.with
18
+ @categories.should_receive(:load_from_cache).once.with
27
19
 
28
20
  @index.load_from_cache
29
21
  end
30
22
  end
31
- end
32
-
33
- context "no categories" do
34
- before(:each) do
35
- @combinator = stub :combinator
36
- Query::Combinator.stub! :new => @combinator
37
-
38
- @index = Index::Type.new :some_name, :some_result_type, false
39
- end
40
-
41
23
  describe "possible_combinations" do
42
24
  it "delegates to the combinator" do
43
- @combinator.should_receive(:possible_combinations_for).once.with :some_token
25
+ @categories.should_receive(:possible_combinations_for).once.with :some_token
44
26
 
45
27
  @index.possible_combinations :some_token
46
28
  end
47
29
  end
48
30
  end
49
31
 
32
+ context "no categories" do
33
+ it "works" do
34
+ Index::Type.new :some_name
35
+ end
36
+ end
37
+
50
38
  end
@@ -12,19 +12,19 @@ describe Index::Wrappers::ExactFirst do
12
12
 
13
13
  describe "self.wrap" do
14
14
  context "type" do
15
- it "wraps each category" do
16
- category = stub :category, :name => :some_category, :exact => :exact, :partial => :partial
17
-
18
- type = Index::Type.new :type_name, :result_type, false, category
19
-
20
- Index::Wrappers::ExactFirst.wrap type
21
-
22
- type.categories.first.should be_kind_of(Index::Wrappers::ExactFirst)
23
- end
15
+ # FIXME
16
+ #
17
+ # it "wraps each category" do
18
+ # type = Index::Type.new :type_name
19
+ # type.add_category :some_category
20
+ #
21
+ # Index::Wrappers::ExactFirst.wrap type
22
+ #
23
+ # type.categories.should be_kind_of(Index::Wrappers::ExactFirst)
24
+ # end
24
25
  it "returns the type" do
25
- category = stub :category, :name => :some_category, :exact => :exact, :partial => :partial
26
-
27
- type = Index::Type.new :type_name, :result_type, false, category
26
+ type = Index::Type.new :type_name
27
+ type.add_category :some_category
28
28
 
29
29
  Index::Wrappers::ExactFirst.wrap(type).should == type
30
30
  end
@@ -1,12 +1,12 @@
1
1
  require 'spec_helper'
2
2
 
3
- describe Index::Bundle do
3
+ describe Indexing::Bundle do
4
4
 
5
5
  before(:each) do
6
6
  @category = stub :category, :name => :some_category
7
7
  @type = stub :type, :name => :some_type
8
8
  @partial_strategy = Cacher::Partial::Substring.new :from => 1
9
- @exact = Index::Bundle.new :some_name, @category, @type, @partial_strategy, nil, nil
9
+ @exact = Indexing::Bundle.new :some_name, @category, @type, nil, @partial_strategy, nil
10
10
  end
11
11
 
12
12
  def generate_random_keys amount