Sha256: e65810152400f784dda2cf16a2dccacffe768927d1b1b53572fd0355df918ed2

Contents?: true

Size: 751 Bytes

Versions: 10

Compression:

Stored size: 751 Bytes

Contents

module ActiveFedora
  ##
  # An extension strategy to also apply solr indexes for each property.
  # @note If how a field is indexed changes based on property, this would be a
  #   good place to define that.
  class SchemaIndexingStrategy
    # @param [#index] indexer The indexer to use
    def initialize(indexer=Indexers::NullIndexer.instance)
      @indexer = indexer
    end

    # @param [ActiveFedora::Base] object The object to apply the property to.
    # @param [ActiveTriples::Property, #name, #to_h] property The property to define.
    def apply(object, property)
      object.property property.name, property.to_h do |index|
        indexer.new(property).index(index)
      end
    end

    private

    attr_reader :indexer
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
active-fedora-9.5.0 lib/active_fedora/schema_indexing_strategy.rb
active-fedora-9.4.3 lib/active_fedora/schema_indexing_strategy.rb
active-fedora-9.4.2 lib/active_fedora/schema_indexing_strategy.rb
active-fedora-9.4.1 lib/active_fedora/schema_indexing_strategy.rb
active-fedora-9.4.0 lib/active_fedora/schema_indexing_strategy.rb
active-fedora-9.3.0 lib/active_fedora/schema_indexing_strategy.rb
active-fedora-9.2.1 lib/active_fedora/schema_indexing_strategy.rb
active-fedora-9.2.0 lib/active_fedora/schema_indexing_strategy.rb
active-fedora-9.2.0.rc2 lib/active_fedora/schema_indexing_strategy.rb
active-fedora-9.2.0.rc1 lib/active_fedora/schema_indexing_strategy.rb