Class: Hyrax::CollectionIndexer

Inherits:
Hydra::PCDM::CollectionIndexer
  • Object
show all
Includes:
IndexesThumbnails
Defined in:
app/indexers/hyrax/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



8
9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'app/indexers/hyrax/collection_indexer.rb', line 8

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