lib/solrizer/field_name_mapper.rb in solrizer-2.0.0 vs lib/solrizer/field_name_mapper.rb in solrizer-2.1.0.rc1
- old
+ new
@@ -13,24 +13,27 @@
end
# Re-loads solr mappings for the default field mapper's class
# and re-sets the default field mapper to an FieldMapper instance with those mappings.
def load_mappings( config_path=nil)
- self.default_field_mapper.class.load_mappings(config_path)
+ # Dynamically create a new class?
+ self.default_field_mapper.class.clear_mappings
+ self.default_field_mapper.class.send(:include, Solrizer::FieldMapper::Defaults)
+ self.default_field_mapper.class.load_mappings(config_path) if config_path
self.default_field_mapper = self.default_field_mapper.class.new
end
def solr_name(field_name, field_type, index_type = :searchable)
self.default_field_mapper.solr_name(field_name, field_type, index_type)
end
def default_field_mapper
- @@default_field_mapper ||= Solrizer::FieldMapper::Default.new
+ Solrizer.default_field_mapper
end
- def default_field_mapper=(field_mapper)
- @@default_field_mapper = field_mapper
+ def default_field_mapper=(obj)
+ Solrizer.default_field_mapper = obj
end
end
# Instance Methods -- These methods will be available on instances of classes that include this module
@@ -43,6 +46,6 @@
def solr_name(field_name, field_type, index_type = :searchable)
self.class.solr_name(field_name, field_type, index_type)
end
-end
\ No newline at end of file
+end