Class: Valkyrie::Persistence::Solr::CompositeIndexer::Instance

Inherits:
Object
  • Object
show all
Defined in:
lib/valkyrie/persistence/solr/composite_indexer.rb

Overview

Class providing the common method interface for the Indexer

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(indexers, resource:) ⇒ Instance

Returns a new instance of Instance.

Parameters:



27
28
29
30
# File 'lib/valkyrie/persistence/solr/composite_indexer.rb', line 27

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.



23
24
25
# File 'lib/valkyrie/persistence/solr/composite_indexer.rb', line 23

def indexers
  @indexers
end

#resourceObject (readonly)

Returns the value of attribute resource.



23
24
25
# File 'lib/valkyrie/persistence/solr/composite_indexer.rb', line 23

def resource
  @resource
end

Instance Method Details

#to_solrArray<Hash>

Generate the Solr Documents from the indexers

Returns:

  • (Array<Hash>)


34
35
36
# File 'lib/valkyrie/persistence/solr/composite_indexer.rb', line 34

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