Module: Spotlight::SearchHelper

Included in:
Catalog, DashboardsController, ExhibitsController, FieldMetadata, PagesController, Search, SearchConfigurationsController, SearchesController, SolrController
Defined in:
app/controllers/concerns/spotlight/search_helper.rb

Overview

Instance Method Summary collapse

Instance Method Details

#search_service(user_params = respond_to?(:search_state, true) ? search_state.to_h : {}) ⇒ Object



6
7
8
9
10
# File 'app/controllers/concerns/spotlight/search_helper.rb', line 6

def search_service(user_params = respond_to?(:search_state, true) ? search_state.to_h : {})
  klass = respond_to?(:search_service_class) ? search_service_class : Blacklight::SearchService

  klass.new(config: blacklight_config, user_params: user_params, **search_service_context)
end

#search_service_contextHash

Returns a hash of context information to pass through to the search service.

Returns:

  • (Hash)

    a hash of context information to pass through to the search service



13
14
15
16
17
# File 'app/controllers/concerns/spotlight/search_helper.rb', line 13

def search_service_context
  return {} unless respond_to?(:current_ability)

  { current_ability: current_ability }
end