Sha256: 94085121fc2f525beb5e31d7a01452eed3a9a945746817f2c4c40a2b0500ee7f

Contents?: true

Size: 950 Bytes

Versions: 13

Compression:

Stored size: 950 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
    include Blacklight::SearchHelper

    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 = 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
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
hyrax-3.6.0 app/services/hyrax/collection_member_service.rb
hyrax-3.5.0 app/services/hyrax/collection_member_service.rb
hyrax-3.4.2 app/services/hyrax/collection_member_service.rb
hyrax-3.4.1 app/services/hyrax/collection_member_service.rb
hyrax-3.4.0 app/services/hyrax/collection_member_service.rb
hyrax-3.3.0 app/services/hyrax/collection_member_service.rb
hyrax-3.2.0 app/services/hyrax/collection_member_service.rb
hyrax-3.1.0 app/services/hyrax/collection_member_service.rb
hyrax-3.0.2 app/services/hyrax/collection_member_service.rb
hyrax-3.0.1 app/services/hyrax/collection_member_service.rb
hyrax-3.0.0 app/services/hyrax/collection_member_service.rb
hyrax-3.0.0.pre.rc4 app/services/hyrax/collection_member_service.rb
hyrax-3.0.0.pre.rc3 app/services/hyrax/collection_member_service.rb