Class: Hyrax::CollectionsService

Inherits:
SearchService
  • Object
show all
Defined in:
app/services/hyrax/collections_service.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(context) ⇒ CollectionsService

Returns a new instance of CollectionsService.

Parameters:

  • context (#repository, #blacklight_config, #current_ability)


10
11
12
13
# File 'app/services/hyrax/collections_service.rb', line 10

def initialize(context)
  super(config: context.blacklight_config, user_params: context.params, search_builder_class: self.class.list_search_builder_class, scope: context)
  @current_ability = context.current_ability
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Hyrax::SearchService

Instance Attribute Details

#contextObject (readonly)

Returns the value of attribute context.



4
5
6
# File 'app/services/hyrax/collections_service.rb', line 4

def context
  @context
end

Instance Method Details

#search_results(access = nil) ⇒ Object

Parameters:

  • access (Symbol) (defaults to: nil)

    :read or :edit



16
17
18
19
20
21
22
23
24
25
26
27
# File 'app/services/hyrax/collections_service.rb', line 16

def search_results(access = nil)
  response, _docs = super() do |builder|
    builder.with_access(access) if access
    builder.rows(100)

    yield builder if block_given?

    builder
  end

  response.documents
end