module ActiveFedora::RDF::DatastreamIndexing
def apply_prefix(name, file_path)
def apply_prefix(name, file_path) prefix(file_path) + name.to_s end
def indexing_service
def indexing_service @indexing_service ||= self.class.indexer.new(self) end
def prefix_method(file_path)
def prefix_method(file_path) lambda { |field_name| apply_prefix(field_name, file_path) } end
def primary_solr_name(field, file_path)
def primary_solr_name(field, file_path) config = self.class.config_for_term_or_uri(field) return nil unless config # punt on index names for deep nodes! if behaviors = config.behaviors behaviors.each do |behavior| result = ActiveFedora::SolrQueryBuilder.solr_name(apply_prefix(field, file_path), behavior, type: config.type) return result if Solrizer::DefaultDescriptors.send(behavior).evaluate_suffix(:text).stored? end raise RuntimeError "no stored fields were found" end end
def solrize_rdf_assertions(file_path, solr_doc = {})
-
solr_doc
(Hash
) -- @default an empty Hash -
file_path
(String
) -- used to prefix the keys in the solr document
def solrize_rdf_assertions(file_path, solr_doc = {}) solr_doc.merge! indexing_service.generate_solr_document(prefix_method(file_path)) end
def to_solr(solr_doc={}, opts={}) # :nodoc:
def to_solr(solr_doc={}, opts={}) # :nodoc: super.tap do |solr_doc| solrize_rdf_assertions(opts[:name], solr_doc) end end