Sha256: 374fc532c853377b294258925e7e7c1b00dc8b94a084374985b7c67994933a95

Contents?: true

Size: 973 Bytes

Versions: 34

Compression:

Stored size: 973 Bytes

Contents

module Hyrax
  class CollectionIndexer < Hydra::PCDM::CollectionIndexer
    include Hyrax::IndexesThumbnails

    STORED_LONG = Solrizer::Descriptor.new(:long, :stored)

    self.thumbnail_path_service = Hyrax::CollectionThumbnailPathService

    # @yield [Hash] calls the yielded block with the solr document
    # @return [Hash] the solr document WITH all changes
    def generate_solr_document
      super.tap do |solr_doc|
        # Makes Collections show under the "Collections" tab
        Solrizer.set_field(solr_doc, 'generic_type', 'Collection', :facetable)
        # Index the size of the collection in bytes
        solr_doc[Solrizer.solr_name(:bytes, STORED_LONG)] = object.bytes
        solr_doc['visibility_ssi'] = object.visibility

        object.in_collections.each do |col|
          (solr_doc['member_of_collection_ids_ssim'] ||= []) << col.id
          (solr_doc['member_of_collections_ssim'] ||= []) << col.to_s
        end
      end
    end
  end
end

Version data entries

34 entries across 34 versions & 1 rubygems

Version Path
hyrax-2.6.0 app/indexers/hyrax/collection_indexer.rb
hyrax-2.5.1 app/indexers/hyrax/collection_indexer.rb
hyrax-2.5.0 app/indexers/hyrax/collection_indexer.rb
hyrax-2.4.1 app/indexers/hyrax/collection_indexer.rb
hyrax-3.0.0.pre.beta1 app/indexers/hyrax/collection_indexer.rb
hyrax-2.4.0 app/indexers/hyrax/collection_indexer.rb
hyrax-2.3.3 app/indexers/hyrax/collection_indexer.rb
hyrax-2.3.2 app/indexers/hyrax/collection_indexer.rb
hyrax-2.3.1 app/indexers/hyrax/collection_indexer.rb
hyrax-2.3.0 app/indexers/hyrax/collection_indexer.rb
hyrax-2.0.3 app/indexers/hyrax/collection_indexer.rb
hyrax-2.2.4 app/indexers/hyrax/collection_indexer.rb
hyrax-2.2.3 app/indexers/hyrax/collection_indexer.rb
hyrax-2.2.2 app/indexers/hyrax/collection_indexer.rb
hyrax-2.2.1 app/indexers/hyrax/collection_indexer.rb
hyrax-2.2.0 app/indexers/hyrax/collection_indexer.rb
hyrax-2.1.0 app/indexers/hyrax/collection_indexer.rb
hyrax-2.1.0.rc4 app/indexers/hyrax/collection_indexer.rb
hyrax-2.1.0.rc3 app/indexers/hyrax/collection_indexer.rb
hyrax-2.1.0.rc2 app/indexers/hyrax/collection_indexer.rb