Class: DorIndexing::Indexers::IdentifiableIndexer

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

Overview

Indexes the druid, metadata sources, and the apo titles

Constant Summary collapse

CURRENT_CATALOG_TYPE =
'folio'
@@apo_hash =

Module-level variable, shared between ALL mixin includers (and ALL their includers/extenders)! used for caching apo titles

{}

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(cocina:, cocina_finder:, administrative_tags_finder:) ⇒ IdentifiableIndexer

Returns a new instance of IdentifiableIndexer.



11
12
13
14
15
# File 'lib/dor_indexing/indexers/identifiable_indexer.rb', line 11

def initialize(cocina:, cocina_finder:, administrative_tags_finder:, **)
  @cocina = cocina
  @cocina_finder = cocina_finder
  @administrative_tags_finder = administrative_tags_finder
end

Instance Attribute Details

#administrative_tags_finderObject (readonly)

Returns the value of attribute administrative_tags_finder.



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

def administrative_tags_finder
  @administrative_tags_finder
end

#cocinaObject (readonly)

Returns the value of attribute cocina.



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

def cocina
  @cocina
end

#cocina_finderObject (readonly)

Returns the value of attribute cocina_finder.



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

def cocina_finder
  @cocina_finder
end

Class Method Details

.reset_cache!Object

Clears out the cache of apos. Used primarily in testing.



33
34
35
# File 'lib/dor_indexing/indexers/identifiable_indexer.rb', line 33

def self.reset_cache!
  @@apo_hash = {} # rubocop:disable Style/ClassVars
end

Instance Method Details

#to_solrHash

Returns the partial solr document for identifiable concerns.

Returns:

  • (Hash)

    the partial solr document for identifiable concerns



22
23
24
25
26
27
28
29
30
# File 'lib/dor_indexing/indexers/identifiable_indexer.rb', line 22

def to_solr
  {}.tap do |solr_doc|
    add_apo_titles(solr_doc, cocina.administrative.hasAdminPolicy)

    solr_doc['metadata_source_ssim'] =  unless cocina.is_a? Cocina::Models::AdminPolicyWithMetadata
    solr_doc['druid_prefixed_ssi'] = cocina.externalIdentifier
    solr_doc['druid_bare_ssi'] = cocina.externalIdentifier.delete_prefix('druid:')
  end
end