Sha256: cba24b3640f11d14852008cecd7d8668b0066b7276d1d837648b1100970c811a

Contents?: true

Size: 932 Bytes

Versions: 48

Compression:

Stored size: 932 Bytes

Contents

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

48 entries across 48 versions & 1 rubygems

Version Path
hyrax-2.9.6 app/search_builders/hyrax/member_with_files_search_builder.rb
hyrax-2.9.5 app/search_builders/hyrax/member_with_files_search_builder.rb
hyrax-2.9.4 app/search_builders/hyrax/member_with_files_search_builder.rb
hyrax-2.9.3 app/search_builders/hyrax/member_with_files_search_builder.rb
hyrax-2.9.2 app/search_builders/hyrax/member_with_files_search_builder.rb
hyrax-2.9.1 app/search_builders/hyrax/member_with_files_search_builder.rb
hyrax-2.9.0 app/search_builders/hyrax/member_with_files_search_builder.rb
hyrax-2.8.0 app/search_builders/hyrax/member_with_files_search_builder.rb
hyrax-2.7.2 app/search_builders/hyrax/member_with_files_search_builder.rb
hyrax-2.7.1 app/search_builders/hyrax/member_with_files_search_builder.rb
hyrax-2.7.0 app/search_builders/hyrax/member_with_files_search_builder.rb
hyrax-2.6.0 app/search_builders/hyrax/member_with_files_search_builder.rb
hyrax-3.0.0.pre.rc1 app/search_builders/hyrax/member_with_files_search_builder.rb
hyrax-3.0.0.pre.beta3 app/search_builders/hyrax/member_with_files_search_builder.rb
hyrax-2.5.1 app/search_builders/hyrax/member_with_files_search_builder.rb
hyrax-2.5.0 app/search_builders/hyrax/member_with_files_search_builder.rb
hyrax-3.0.0.pre.beta2 app/search_builders/hyrax/member_with_files_search_builder.rb
hyrax-2.4.1 app/search_builders/hyrax/member_with_files_search_builder.rb
hyrax-3.0.0.pre.beta1 app/search_builders/hyrax/member_with_files_search_builder.rb
hyrax-2.4.0 app/search_builders/hyrax/member_with_files_search_builder.rb