Sha256: 266ef29a6c25c8904e19cd6c970eafa6451423813f47c7d23b7857cdc4949d2b

Contents?: true

Size: 934 Bytes

Versions: 10

Compression:

Stored size: 934 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

    protected

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

Version data entries

10 entries across 10 versions & 2 rubygems

Version Path
hyrax-1.1.1 app/search_builders/hyrax/member_with_files_search_builder.rb
hyrax-1.1.0 app/search_builders/hyrax/member_with_files_search_builder.rb
hyrax-1.0.5 app/search_builders/hyrax/member_with_files_search_builder.rb
hyrax-1.0.4 app/search_builders/hyrax/member_with_files_search_builder.rb
hyrax-1.0.3 app/search_builders/hyrax/member_with_files_search_builder.rb
hyrax-1.0.2 app/search_builders/hyrax/member_with_files_search_builder.rb
hyrax-1.0.1 app/search_builders/hyrax/member_with_files_search_builder.rb
hyrax-1.0.0.rc2 app/search_builders/hyrax/member_with_files_search_builder.rb
hyrax-1.0.0.rc1 app/search_builders/hyrax/member_with_files_search_builder.rb
test_hyrax-0.0.1.alpha app/search_builders/hyrax/member_with_files_search_builder.rb