Class: DorIndexing::Indexers::CollectionTitleIndexer
- Inherits:
-
Object
- Object
- DorIndexing::Indexers::CollectionTitleIndexer
- Defined in:
- lib/dor_indexing/indexers/collection_title_indexer.rb
Overview
Indexes collection titles for an object
Instance Attribute Summary collapse
-
#cocina ⇒ Object
readonly
Returns the value of attribute cocina.
-
#parent_collections ⇒ Object
readonly
Returns the value of attribute parent_collections.
Instance Method Summary collapse
-
#initialize(cocina:, parent_collections:) ⇒ CollectionTitleIndexer
constructor
A new instance of CollectionTitleIndexer.
-
#to_solr ⇒ Hash
The partial solr document for collection title concerns.
Constructor Details
#initialize(cocina:, parent_collections:) ⇒ CollectionTitleIndexer
Returns a new instance of CollectionTitleIndexer.
9 10 11 12 |
# File 'lib/dor_indexing/indexers/collection_title_indexer.rb', line 9 def initialize(cocina:, parent_collections:, **) @cocina = cocina @parent_collections = parent_collections end |
Instance Attribute Details
#cocina ⇒ Object (readonly)
Returns the value of attribute cocina.
7 8 9 |
# File 'lib/dor_indexing/indexers/collection_title_indexer.rb', line 7 def cocina @cocina end |
#parent_collections ⇒ Object (readonly)
Returns the value of attribute parent_collections.
7 8 9 |
# File 'lib/dor_indexing/indexers/collection_title_indexer.rb', line 7 def parent_collections @parent_collections end |
Instance Method Details
#to_solr ⇒ Hash
Returns the partial solr document for collection title concerns.
15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/dor_indexing/indexers/collection_title_indexer.rb', line 15 def to_solr {}.tap do |solr_doc| parent_collections.each do |collection_obj| coll_title = Cocina::Models::Builders::TitleBuilder.build(collection_obj.description.title) next if coll_title.blank? solr_doc['collection_title_ssim'] ||= [] solr_doc['collection_title_ssim'] << coll_title solr_doc['collection_title_tesim'] ||= [] solr_doc['collection_title_tesim'] << coll_title end end end |