Class: Dor::CompositeIndexer::Instance

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(indexers, resource:) ⇒ Instance

Returns a new instance of Instance.



16
17
18
19
# File 'lib/dor/indexers/composite_indexer.rb', line 16

def initialize(indexers, resource:)
  @resource = resource
  @indexers = indexers.map { |i| i.new(resource: resource) }
end

Instance Attribute Details

#indexersObject (readonly)

Returns the value of attribute indexers.



15
16
17
# File 'lib/dor/indexers/composite_indexer.rb', line 15

def indexers
  @indexers
end

#resourceObject (readonly)

Returns the value of attribute resource.



15
16
17
# File 'lib/dor/indexers/composite_indexer.rb', line 15

def resource
  @resource
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



22
23
24
# File 'lib/dor/indexers/composite_indexer.rb', line 22

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