lib/picky/internals/indexed/category.rb in picky-2.1.2 vs lib/picky/internals/indexed/category.rb in picky-2.2.0
- old
+ new
@@ -7,37 +7,36 @@
# For example an index category for names holds a exact and
# a partial index bundle for names.
#
class Category
+ include Internals::Shared::Category
+
attr_accessor :exact
- attr_reader :identifier, :name
+ attr_reader :name, :index
attr_writer :partial
#
#
def initialize name, index, options = {}
- @name = name
+ @name = name
+ @index = index
- configuration = Configuration::Index.new index, self
-
- @identifier = configuration.identifier
-
# TODO Push the defaults out into the index.
#
@partial_strategy = options[:partial] || Internals::Generators::Partial::Default
similarity = options[:similarity] || Internals::Generators::Similarity::Default
bundle_class = options[:indexed_bundle_class] || Bundle::Memory
- @exact = bundle_class.new :exact, configuration, similarity
- @partial = bundle_class.new :partial, configuration, similarity
+ @exact = bundle_class.new :exact, self, similarity
+ @partial = bundle_class.new :partial, self, similarity
# @exact = exact_lambda.call(@exact, @partial) if exact_lambda = options[:exact_lambda]
# @partial = partial_lambda.call(@exact, @partial) if partial_lambda = options[:partial_lambda]
# TODO Extract?
#
- Query::Qualifiers.add(configuration.category_name, generate_qualifiers_from(options) || [name])
+ Query::Qualifiers.add(name, generate_qualifiers_from(options) || [name])
end
def to_s
<<-CATEGORY
Category(#{name}):
\ No newline at end of file