Module: IiifPrint::FileSetIndexer
- Defined in:
- app/indexers/concerns/iiif_print/file_set_indexer.rb
Class Method Summary collapse
-
.decorate(base) ⇒ Class
Why ‘.decorate`? In my tests for Rails 5.2, I’m not able to use the prepended nor included blocks to assign a class_attribute when I “prepend” a module to the base class.
Instance Method Summary collapse
Class Method Details
.decorate(base) ⇒ Class
Why ‘.decorate`? In my tests for Rails 5.2, I’m not able to use the prepended nor included blocks to assign a class_attribute when I “prepend” a module to the base class. This method allows me to handle that behavior.
11 12 13 14 15 |
# File 'app/indexers/concerns/iiif_print/file_set_indexer.rb', line 11 def self.decorate(base) base.prepend(self) base.class_attribute :iiif_print_lineage_service, default: IiifPrint::LineageService base end |
Instance Method Details
#generate_solr_document ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 |
# File 'app/indexers/concerns/iiif_print/file_set_indexer.rb', line 17 def generate_solr_document super.tap do |solr_doc| # only UV viewable images should have is_page_of, it is only used for iiif search solr_doc['is_page_of_ssim'] = iiif_print_lineage_service.ancestor_ids_for(object) if object.mime_type&.match(/image/) # index for full text search text = IiifPrint::Data::WorkDerivatives.data(from: object, of_type: 'txt') text = text.tr("\n", ' ').squeeze(' ') solr_doc['all_text_timv'] = text solr_doc['all_text_tsimv'] = text end end |