Sha256: f290185ebbdaf76c7755f3233e904c73486a2379ce6b2804331b6c63618f9e9c

Contents?: true

Size: 849 Bytes

Versions: 10

Compression:

Stored size: 849 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

    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['thumbnail_path_ss'] = thumbnail_path

        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

10 entries across 10 versions & 2 rubygems

Version Path
hyrax-1.1.1 app/indexers/hyrax/collection_indexer.rb
hyrax-1.1.0 app/indexers/hyrax/collection_indexer.rb
hyrax-1.0.5 app/indexers/hyrax/collection_indexer.rb
hyrax-1.0.4 app/indexers/hyrax/collection_indexer.rb
hyrax-1.0.3 app/indexers/hyrax/collection_indexer.rb
hyrax-1.0.2 app/indexers/hyrax/collection_indexer.rb
hyrax-1.0.1 app/indexers/hyrax/collection_indexer.rb
hyrax-1.0.0.rc2 app/indexers/hyrax/collection_indexer.rb
hyrax-1.0.0.rc1 app/indexers/hyrax/collection_indexer.rb
test_hyrax-0.0.1.alpha app/indexers/hyrax/collection_indexer.rb