Class: Hyrax::FileSetIndexer

Inherits:
ActiveFedora::IndexingService
  • Object
show all
Includes:
IndexesBasicMetadata, IndexesThumbnails
Defined in:
app/indexers/hyrax/file_set_indexer.rb

Constant Summary collapse

STORED_LONG =
ActiveFedora::Indexing::Descriptor.new(:long, :stored)

Instance Method Summary collapse

Methods included from IndexesBasicMetadata

#rdf_service

Methods included from IndexesThumbnails

#index_thumbnails, #thumbnail_path

Instance Method Details

#generate_solr_documentObject

rubocop:disable Metrics/AbcSize, Metrics/MethodLength



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'app/indexers/hyrax/file_set_indexer.rb', line 8

def generate_solr_document # rubocop:disable Metrics/AbcSize, Metrics/MethodLength
  super.tap do |solr_doc|
    solr_doc['hasRelatedMediaFragment_ssim'] = object.representative_id
    solr_doc['hasRelatedImage_ssim'] = object.thumbnail_id
    # Label is the actual file name. It's not editable by the user.
    solr_doc['label_tesim'] = object.label
    solr_doc['label_ssi']   = object.label
    solr_doc['file_format_tesim'] = file_format
    solr_doc['file_format_sim']   = file_format
    solr_doc['file_size_lts'] = object.file_size[0]
    solr_doc['all_text_timv'] = object.extracted_text.content if object.extracted_text.present?
    solr_doc['height_is'] = Integer(object.height.first) if object.height.present?
    solr_doc['width_is']  = Integer(object.width.first) if object.width.present?
    solr_doc['visibility_ssi'] = object.visibility
    solr_doc['mime_type_ssi']  = object.mime_type
    # Index the Fedora-generated SHA1 digest to create a linkage between
    # files on disk (in fcrepo.binary-store-path) and objects in the repository.
    solr_doc['digest_ssim']             = [digest_from_content]
    solr_doc['page_count_tesim']        = object.page_count
    solr_doc['file_title_tesim']        = object.file_title
    solr_doc['duration_tesim']          = object.duration
    solr_doc['sample_rate_tesim']       = object.sample_rate
    solr_doc['original_checksum_tesim'] = object.original_checksum
    solr_doc['alpha_channels_ssi']      = object.alpha_channels
    solr_doc['original_file_id_ssi']    = original_file_id
    solr_doc['generic_type_si'] = 'FileSet'
  end
end