Class: DorIndexing::Indexers::ObjectFilesIndexer
- Inherits:
-
Object
- Object
- DorIndexing::Indexers::ObjectFilesIndexer
- Defined in:
- lib/dor_indexing/indexers/object_files_indexer.rb
Overview
Indexes the information about files in the object
Instance Attribute Summary collapse
-
#cocina ⇒ Object
readonly
Returns the value of attribute cocina.
Instance Method Summary collapse
-
#initialize(cocina:) ⇒ ObjectFilesIndexer
constructor
A new instance of ObjectFilesIndexer.
-
#to_solr ⇒ Hash
The partial solr document for files in the object.
Constructor Details
#initialize(cocina:) ⇒ ObjectFilesIndexer
Returns a new instance of ObjectFilesIndexer.
9 10 11 |
# File 'lib/dor_indexing/indexers/object_files_indexer.rb', line 9 def initialize(cocina:, **) @cocina = cocina end |
Instance Attribute Details
#cocina ⇒ Object (readonly)
Returns the value of attribute cocina.
7 8 9 |
# File 'lib/dor_indexing/indexers/object_files_indexer.rb', line 7 def cocina @cocina end |
Instance Method Details
#to_solr ⇒ Hash
Returns the partial solr document for files in the object.
14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/dor_indexing/indexers/object_files_indexer.rb', line 14 def to_solr { 'content_type_ssim' => type(cocina.type), 'content_file_mimetypes_ssim' => files.map(&:hasMimeType).uniq, 'content_file_count_itsi' => files.size, 'shelved_content_file_count_itsi' => shelved_files.size, 'resource_count_itsi' => file_sets.size, 'preserved_size_dbtsi' => preserved_size, # double (trie) to support very large sizes 'content_file_roles_ssim' => files.filter_map(&:use), # first_shelved_image is neither indexed nor multiple 'first_shelved_image_ss' => first_shelved_image } end |