Class: CurationConcerns::CollectionIndexer

Inherits:
Hydra::PCDM::CollectionIndexer
  • Object
show all
Includes:
IndexesThumbnails
Defined in:
app/indexers/curation_concerns/collection_indexer.rb

Constant Summary collapse

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

Instance Method Summary collapse

Methods included from IndexesThumbnails

#index_thumbnails, #thumbnail_path

Instance Method Details

#generate_solr_documentObject



6
7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'app/indexers/curation_concerns/collection_indexer.rb', line 6

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