Sha256: 39d57323495fdbf1841a3313f4ac8a3992bc0dc531f54057810e950277c156a4

Contents?: true

Size: 964 Bytes

Versions: 10

Compression:

Stored size: 964 Bytes

Contents

# frozen_string_literal: true

module Hyrax
  ##
  # Returns a list of solr documents for collections the item is a part of
  class CollectionMemberService
    include Blacklight::Configurable

    attr_reader :item, :current_ability

    copy_blacklight_config_from(CatalogController)

    ##
    # @param [SolrDocument] item represents a work
    # @param [Hyrax::Ability] ability
    def self.run(item, ability)
      new(item, ability).list_collections
    end

    def initialize(item, ability)
      @item = item
      @current_ability = ability
    end

    def list_collections
      query = collection_search_builder.rows(1000)
      resp = blacklight_config.repository.search(query)
      resp.documents
    end

    def collection_search_builder
      @collection_search_builder ||= ParentCollectionSearchBuilder.new([:include_item_ids, :add_paging_to_solr, :add_access_controls_to_solr_params], self)
    end

    def search_state_class; end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
hyrax-5.0.1 app/services/hyrax/collection_member_service.rb
hyrax-5.0.0 app/services/hyrax/collection_member_service.rb
hyrax-5.0.0.rc3 app/services/hyrax/collection_member_service.rb
hyrax-5.0.0.rc2 app/services/hyrax/collection_member_service.rb
hyrax-5.0.0.rc1 app/services/hyrax/collection_member_service.rb
hyrax-4.0.0 app/services/hyrax/collection_member_service.rb
hyrax-4.0.0.rc3 app/services/hyrax/collection_member_service.rb
hyrax-4.0.0.rc2 app/services/hyrax/collection_member_service.rb
hyrax-4.0.0.rc1 app/services/hyrax/collection_member_service.rb
hyrax-4.0.0.beta2 app/services/hyrax/collection_member_service.rb