Class: Dor::ReleasableIndexer

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from SolrDocHelper

#add_solr_value

Constructor Details

#initialize(resource:) ⇒ ReleasableIndexer

Returns a new instance of ReleasableIndexer.



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

def initialize(resource:)
  @resource = resource
end

Instance Attribute Details

#resourceObject (readonly)

Returns the value of attribute resource.



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

def resource
  @resource
end

Instance Method Details

#to_solrHash

Returns the partial solr document for releasable concerns.

Returns:

  • (Hash)

    the partial solr document for releasable concerns



13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/dor/indexers/releasable_indexer.rb', line 13

def to_solr
  solr_doc = {}

  # TODO: sort of worried about the performance impact in bulk reindex
  # situations, since released_for recurses all parent collections.  jmartin 2015-07-14
  resource.released_for(true).each { |release_target, release_info|
    add_solr_value(solr_doc, 'released_to', release_target, :symbol, []) if release_info['release']
  }

  # TODO: need to solrize whether item is released to purl?  does released_for return that?
  # logic is: "True when there is a published lifecycle and Access Rights is anything but Dark"

  solr_doc
end