Sha256: fdd067e09a1e795bd7e337f18b04b49c8516da1c1920f4f8eb19f83ce49b081c

Contents?: true

Size: 956 Bytes

Versions: 22

Compression:

Stored size: 956 Bytes

Contents

# frozen_string_literal: true
module Hyrax
  # Finds the child objects contained within a collection
  class MemberWithFilesSearchBuilder < ::SearchBuilder
    class_attribute :from_field
    self.from_field = 'child_object_ids_ssim'
    self.default_processor_chain += [:include_collection_ids, :include_contained_files]

    # This is like include_collection_ids, but it also joins the files.
    def include_contained_files(solr_parameters)
      solr_parameters[:fq] ||= []
      solr_parameters[:fq] << "{!join from=file_set_ids_ssim to=id}{!join from=child_object_ids_ssim to=id}id:#{collection_id}"
    end

    # include filters into the query to only include the collection memebers
    def include_collection_ids(solr_parameters)
      solr_parameters[:fq] ||= []
      solr_parameters[:fq] << "{!join from=#{from_field} to=id}id:#{collection_id}"
    end

    private

    def collection_id
      blacklight_params.fetch('id')
    end
  end
end

Version data entries

22 entries across 22 versions & 1 rubygems

Version Path
hyrax-5.0.0.rc2 app/search_builders/hyrax/member_with_files_search_builder.rb
hyrax-5.0.0.rc1 app/search_builders/hyrax/member_with_files_search_builder.rb
hyrax-3.6.0 app/search_builders/hyrax/member_with_files_search_builder.rb
hyrax-4.0.0 app/search_builders/hyrax/member_with_files_search_builder.rb
hyrax-4.0.0.rc3 app/search_builders/hyrax/member_with_files_search_builder.rb
hyrax-4.0.0.rc2 app/search_builders/hyrax/member_with_files_search_builder.rb
hyrax-4.0.0.rc1 app/search_builders/hyrax/member_with_files_search_builder.rb
hyrax-3.5.0 app/search_builders/hyrax/member_with_files_search_builder.rb
hyrax-4.0.0.beta2 app/search_builders/hyrax/member_with_files_search_builder.rb
hyrax-3.4.2 app/search_builders/hyrax/member_with_files_search_builder.rb
hyrax-4.0.0.beta1 app/search_builders/hyrax/member_with_files_search_builder.rb
hyrax-3.4.1 app/search_builders/hyrax/member_with_files_search_builder.rb
hyrax-3.4.0 app/search_builders/hyrax/member_with_files_search_builder.rb
hyrax-3.3.0 app/search_builders/hyrax/member_with_files_search_builder.rb
hyrax-3.2.0 app/search_builders/hyrax/member_with_files_search_builder.rb
hyrax-3.1.0 app/search_builders/hyrax/member_with_files_search_builder.rb
hyrax-3.0.2 app/search_builders/hyrax/member_with_files_search_builder.rb
hyrax-3.0.1 app/search_builders/hyrax/member_with_files_search_builder.rb
hyrax-3.0.0 app/search_builders/hyrax/member_with_files_search_builder.rb
hyrax-3.0.0.pre.rc4 app/search_builders/hyrax/member_with_files_search_builder.rb