Class: ActiveFedora::RDF::IndexingService

Inherits:
Object
  • Object
show all
Includes:
Solrizer::Common
Defined in:
lib/active_fedora/rdf/indexing_service.rb

Overview

Responsible for generating the solr document (via #generate_solr_document) of the given object.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(obj) ⇒ IndexingService

Returns a new instance of IndexingService.

Parameters:

  • obj (#resource, #rdf_subject)

    the object to build an solr document for. Its class must respond to ‘properties’ and ‘index_config’



12
13
14
# File 'lib/active_fedora/rdf/indexing_service.rb', line 12

def initialize(obj)
  @object = obj
end

Instance Attribute Details

#objectObject (readonly)

Returns the value of attribute object.



9
10
11
# File 'lib/active_fedora/rdf/indexing_service.rb', line 9

def object
  @object
end

Instance Method Details

#generate_solr_document(prefix_method = nil) {|Hash| ... } ⇒ Hash

Creates a solr document hash for the rdf assertions of the #object

Yields:

  • (Hash)

    yields the solr document

Returns:

  • (Hash)

    the solr document



19
20
21
22
23
# File 'lib/active_fedora/rdf/indexing_service.rb', line 19

def generate_solr_document(prefix_method = nil)
  solr_doc = add_assertions(prefix_method)
  yield(solr_doc) if block_given?
  solr_doc
end