Class: DorIndexing::Indexers::CompositeIndexer::Instance

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

Overview

Instance for a composite indexer

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(indexers) ⇒ Instance

Returns a new instance of Instance.



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

def initialize(indexers, **)
  @indexers = indexers.map do |i|
    i.new(**)
  rescue ArgumentError => e
    raise ArgumentError, "Unable to initialize #{i}. #{e.message}"
  end
end

Instance Attribute Details

#indexersObject (readonly)

Returns the value of attribute indexers.



20
21
22
# File 'lib/dor_indexing/indexers/composite_indexer.rb', line 20

def indexers
  @indexers
end

Instance Method Details

#to_solrHash

Returns the merged solr document for all the sub-indexers.

Returns:

  • (Hash)

    the merged solr document for all the sub-indexers



31
32
33
# File 'lib/dor_indexing/indexers/composite_indexer.rb', line 31

def to_solr
  indexers.map(&:to_solr).inject({}, &:merge)
end