Class: Hyrax::CollectionIndexer

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

Direct Known Subclasses

CollectionWithBasicMetadataIndexer

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_document {|Hash| ... } ⇒ Hash

Returns the solr document WITH all changes.

Yields:

  • (Hash)

    calls the yielded block with the solr document

Returns:

  • (Hash)

    the solr document WITH all changes



11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'app/indexers/hyrax/collection_indexer.rb', line 11

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