Class: ActiveFedora::SchemaIndexingStrategy

Inherits:
Object
  • Object
show all
Defined in:
lib/active_fedora/schema_indexing_strategy.rb

Overview

Note:

If how a field is indexed changes based on property, this would be a good place to define that.

An extension strategy to also apply solr indexes for each property.

Instance Method Summary collapse

Constructor Details

#initialize(indexer = Indexers::NullIndexer.instance) ⇒ SchemaIndexingStrategy



8
9
10
# File 'lib/active_fedora/schema_indexing_strategy.rb', line 8

def initialize(indexer = Indexers::NullIndexer.instance)
  @indexer = indexer
end

Instance Method Details

#apply(object, property) ⇒ Object



14
15
16
17
18
# File 'lib/active_fedora/schema_indexing_strategy.rb', line 14

def apply(object, property)
  object.property property.name, property.to_h do |index|
    indexer.new(property).index(index)
  end
end