Class: DorIndexing::Indexers::ReleasableIndexer

Inherits:
Object
  • Object
show all
Defined in:
lib/dor_indexing/indexers/releasable_indexer.rb

Overview

Indexes the object’s release tags

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(cocina:, parent_collections:, release_tags_finder:) ⇒ ReleasableIndexer

Returns a new instance of ReleasableIndexer.



9
10
11
12
13
# File 'lib/dor_indexing/indexers/releasable_indexer.rb', line 9

def initialize(cocina:, parent_collections:, release_tags_finder:, **)
  @cocina = cocina
  @parent_collections = parent_collections
  @release_tags_finder = release_tags_finder
end

Instance Attribute Details

#cocinaObject (readonly)

Returns the value of attribute cocina.



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

def cocina
  @cocina
end

#parent_collectionsObject (readonly)

Returns the value of attribute parent_collections.



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

def parent_collections
  @parent_collections
end

#release_tags_finderObject (readonly)

Returns the value of attribute release_tags_finder.



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

def release_tags_finder
  @release_tags_finder
end

Instance Method Details

#to_solrHash

Returns the partial solr document for releasable concerns.

Returns:

  • (Hash)

    the partial solr document for releasable concerns



16
17
18
19
20
21
22
23
24
25
# File 'lib/dor_indexing/indexers/releasable_indexer.rb', line 16

def to_solr
  return {} if tags.blank?

  {
    'released_to_ssim' => tags.map(&:to).uniq,
    'released_to_searchworks_dttsi' => searchworks_release_date,
    'released_to_earthworks_dttsi' => earthworks_release_date,
    'released_to_purl_sitemap_dttsi' => purl_sitemap_release_date
  }.compact
end