app/repository_models/curation_concern/model.rb in curate-0.5.6 vs app/repository_models/curation_concern/model.rb in curate-0.6.0
- old
+ new
@@ -16,14 +16,19 @@
def as_json(options)
{ pid: pid, title: title, model: self.class.to_s, curation_concern_type: human_readable_type }
end
+ def as_rdf_object
+ RDF::URI.new(internal_uri)
+ end
+
def to_solr(solr_doc={}, opts={})
super(solr_doc, opts)
index_collection_pids(solr_doc)
solr_doc[Solrizer.solr_name('noid', Sufia::GenericFile.noid_indexer)] = noid
+ solr_doc[Solrizer.solr_name('representative', :stored_searchable)] = self.representative
add_derived_date_created(solr_doc)
return solr_doc
end
def to_s
@@ -49,9 +54,22 @@
end
def derived_dates
dates = Array(date_created)
dates.map { |date| Curate::DateFormatter.parse(date.to_s).to_s }
+ end
+
+ def index_collection_pids(solr_doc)
+ solr_doc[Solrizer.solr_name(:collection, :facetable)] ||= []
+ solr_doc[Solrizer.solr_name(:collection)] ||= []
+ self.collection_ids.each do |collection_id|
+ collection_obj = ActiveFedora::Base.load_instance_from_solr(collection_id)
+ if collection_obj.class == Collection
+ solr_doc[Solrizer.solr_name(:collection, :facetable)] << collection_id
+ solr_doc[Solrizer.solr_name(:collection)] << collection_id
+ end
+ end
+ solr_doc
end
end
end