Module: ActiveFedora::RDF::Indexing
- Extended by:
- ActiveSupport::Concern
- Included in:
- ActiveFedora::RDFDatastream
- Defined in:
- lib/active_fedora/rdf/indexing.rb
Defined Under Namespace
Modules: ClassMethods
Instance Method Summary collapse
- #apply_prefix(name) ⇒ Object
-
#primary_solr_name(field) ⇒ Object
Gives the primary solr name for a column.
-
#to_solr(solr_doc = Hash.new) ⇒ Object
:nodoc:.
Instance Method Details
#apply_prefix(name) ⇒ Object
6 7 8 |
# File 'lib/active_fedora/rdf/indexing.rb', line 6 def apply_prefix(name) prefix + name.to_s end |
#primary_solr_name(field) ⇒ Object
Gives the primary solr name for a column. If there is more than one indexer on the field definition, it gives the first
26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/active_fedora/rdf/indexing.rb', line 26 def primary_solr_name(field) 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::SolrService.solr_name(apply_prefix(field), 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 |
#to_solr(solr_doc = Hash.new) ⇒ Object
:nodoc:
10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/active_fedora/rdf/indexing.rb', line 10 def to_solr(solr_doc = Hash.new) # :nodoc: fields.each do |field_key, field_info| values = resource.get_values(field_key) Array(values).each do |val| if val.kind_of? ::RDF::URI val = val.to_s elsif val.kind_of? ActiveTriples::Resource val = val.solrize end self.class.create_and_insert_terms(apply_prefix(field_key), val, field_info[:behaviors], solr_doc) end end solr_doc end |