Class: Dor::ProcessableIndexer

Inherits:
Object
  • Object
show all
Includes:
SolrDocHelper
Defined in:
lib/dor/indexers/processable_indexer.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from SolrDocHelper

#add_solr_value

Constructor Details

#initialize(resource:) ⇒ ProcessableIndexer

Returns a new instance of ProcessableIndexer.



8
9
10
11
# File 'lib/dor/indexers/processable_indexer.rb', line 8

def initialize(resource:)
  @resource = resource
  @status_service = StatusService.new(resource)
end

Instance Attribute Details

#resourceObject (readonly)

Returns the value of attribute resource.



7
8
9
# File 'lib/dor/indexers/processable_indexer.rb', line 7

def resource
  @resource
end

Instance Method Details

#to_solrHash

Returns the partial solr document for processable concerns.

Returns:

  • (Hash)

    the partial solr document for processable concerns



14
15
16
17
18
19
20
21
22
# File 'lib/dor/indexers/processable_indexer.rb', line 14

def to_solr
  {}.tap do |solr_doc|
    add_versions(solr_doc)
    add_milestones(solr_doc)
    solr_doc['modified_latest_dttsi'] = resource.modified_date.to_datetime.utc.strftime('%FT%TZ')
    add_solr_value(solr_doc, 'rights', resource.rights, :string, [:symbol]) if resource.respond_to? :rights
    add_status(solr_doc)
  end
end