Sha256: 655452e9a1114ebeb9da88ae28aab75812cc787ff374c7fbab1a747f360b82a4

Contents?: true

Size: 1007 Bytes

Versions: 3

Compression:

Stored size: 1007 Bytes

Contents

# customize behavior for IiifSearch
module NewspaperWorks
  module BlacklightIiifSearch
    module SearchBehavior
      ##
      # params to limit the search to items that are children of item
      # modified to make search field conditional on parent object class
      # @return [Hash]
      def object_relation_solr_params
        parent_model = parent_document['has_model_ssim'].find do |v|
          v.include?('Newspaper')
        end
        solr_field_for_search = case parent_model
                                when 'NewspaperPage'
                                  'id'
                                when 'NewspaperIssue'
                                  'issue_id_ssi'
                                when 'NewspaperArticle'
                                  'article_ids_ssim'
                                else
                                  iiif_config[:object_relation_field]
                                end
        { solr_field_for_search => id }
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
newspaper_works-1.0.1 app/models/concerns/newspaper_works/blacklight_iiif_search/search_behavior.rb
newspaper_works-1.0.0 app/models/concerns/newspaper_works/blacklight_iiif_search/search_behavior.rb
newspaper_works-0.1.0 app/models/concerns/newspaper_works/blacklight_iiif_search/search_behavior.rb