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

Returns a new instance of SchemaIndexingStrategy.

Parameters:

  • indexer (#index) (defaults to: Indexers::NullIndexer.instance)

    The indexer to use



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

Parameters:

  • object (ActiveFedora::Base)

    The object to apply the property to.

  • property (ActiveTriples::Property, #name, #to_h)

    The property to define.



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