Sha256: 2f5a6c7d477b3ce54837477b1c046be0da2871da45b0ab59042ceba657a29c09

Contents?: true

Size: 787 Bytes

Versions: 3

Compression:

Stored size: 787 Bytes

Contents

module CurationConcerns
  class CollectionIndexer < Hydra::PCDM::CollectionIndexer
    include IndexesThumbnails
    STORED_LONG = Solrizer::Descriptor.new(:long, :stored)

    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.first_title
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
curation_concerns-2.0.0 app/indexers/curation_concerns/collection_indexer.rb
curation_concerns-2.0.0.rc2 app/indexers/curation_concerns/collection_indexer.rb
curation_concerns-2.0.0.rc1 app/indexers/curation_concerns/collection_indexer.rb