Sha256: aaaf51edee42e12bd8c50c386753d105800c55f3295866507b2e101c26e31bf3

Contents?: true

Size: 715 Bytes

Versions: 2

Compression:

Stored size: 715 Bytes

Contents

# frozen_string_literal: true

module IiifPrint
  module ChildWorkIndexer
    def to_solr
      super.tap do |index_document|
        index_solr_doc(index_document)
      end
    end

    def generate_solr_document
      super.tap do |solr_doc|
        index_solr_doc(solr_doc)
      end
    end

    private

    def index_solr_doc(solr_doc)
      object ||= @object || resource
      solr_doc['is_child_bsi'] ||= object.try(:is_child)
      solr_doc['split_from_pdf_id_ssi'] ||= object.try(:split_from_pdf_id)
      solr_doc['is_page_of_ssim'] = iiif_print_lineage_service.ancestor_ids_for(object)
      solr_doc['member_ids_ssim'] = iiif_print_lineage_service.descendent_member_ids_for(object)
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
iiif_print-2.0.1 app/indexers/concerns/iiif_print/child_work_indexer.rb
iiif_print-2.0.0 app/indexers/concerns/iiif_print/child_work_indexer.rb