def create_document( obj )        
    
    solr_doc = Hash.new
    
    model_klazz_array = ActiveFedora::ContentModel.known_models_for( obj )
    model_klazz_array.delete(ActiveFedora::Base)
    
    # If the object was passed in as an ActiveFedora::Base, call to_solr in order to get the base field entries from ActiveFedora::Base
    # Otherwise, the object was passed in as a model instance other than ActiveFedora::Base,so call its to_solr method & allow it to insert the fields from ActiveFedora::Base
    if obj.class == ActiveFedora::Base
      solr_doc = obj.to_solr(solr_doc)
      logger.debug "  added base fields from #{obj.class.to_s}"
    else
      solr_doc = obj.to_solr(solr_doc)
      model_klazz_array.delete(obj.class)
      logger.debug "    added base fields from #{obj.class.to_s} and model fields from #{obj.class.to_s}"
    end
   
    # Load the object as an instance of each of its other models and get the corresponding solr fields
    # Include :model_only=>true in the options in order to avoid adding the metadata from ActiveFedora::Base every time.
    model_klazz_array.each do |klazz|
      instance = obj.adapt_to(klazz)
      solr_doc = instance.to_solr(solr_doc, :model_only=>true)
      logger.debug "  added solr fields from #{klazz.to_s}"
    end
    
    ::Solrizer::Extractor.insert_solr_field_value(solr_doc, :id_t, "#{obj.pid}" )
    ::Solrizer::Extractor.insert_solr_field_value(solr_doc, :id, "#{obj.pid}" ) unless solr_doc[:id]
    
    return solr_doc
  end
def create_document( obj )        
    
    solr_doc = Hash.new
    
    model_klazz_array = ActiveFedora::ContentModel.known_models_for( obj )
    model_klazz_array.delete(ActiveFedora::Base)
    
    # If the object was passed in as an ActiveFedora::Base, call to_solr in order to get the base field entries from ActiveFedora::Base
    # Otherwise, the object was passed in as a model instance other than ActiveFedora::Base,so call its to_solr method & allow it to insert the fields from ActiveFedora::Base
    if obj.class == ActiveFedora::Base
      solr_doc = obj.to_solr(solr_doc)
      logger.debug "  added base fields from #{obj.class.to_s}"
    else
      solr_doc = obj.to_solr(solr_doc)
      model_klazz_array.delete(obj.class)
      logger.debug "    added base fields from #{obj.class.to_s} and model fields from #{obj.class.to_s}"
    end
   
    # Load the object as an instance of each of its other models and get the corresponding solr fields
    # Include :model_only=>true in the options in order to avoid adding the metadata from ActiveFedora::Base every time.
    model_klazz_array.each do |klazz|
      instance = obj.adapt_to(klazz)
      solr_doc = instance.to_solr(solr_doc, :model_only=>true)
      logger.debug "  added solr fields from #{klazz.to_s}"
    end
    
    ::Solrizer::Extractor.insert_solr_field_value(solr_doc, :id_t, "#{obj.pid}" )
    ::Solrizer::Extractor.insert_solr_field_value(solr_doc, :id, "#{obj.pid}" ) unless solr_doc[:id]
    
    return solr_doc
  end
This method creates a Solr-formatted XML document