Sha256: a2c611d5ebd0d3196454ee4c50027c90e57d02028f19259095a2ecd6347d7468

Contents?: true

Size: 1.05 KB

Versions: 53

Compression:

Stored size: 1.05 KB

Contents

# frozen_string_literal: true

# The Searchable module can be included onto classes that need to initialize a SearchService.
# There are three dependencies you must provide on the including class. Typically these
# would be provided by Blacklight::Controller
#  1. search_state
#  2. blacklight_config
#  3. search_service_class
#
# Additionally, the including class may override the search_service_context method to provide
# further context to the SearchService. For example you could override this to provide the
# currently signed in user.
module Blacklight::Searchable
  # @return [Blacklight::SearchService]
  def search_service
    search_service_class.new(config: blacklight_config, search_state: search_state, user_params: search_state.to_h, **search_service_context)
  end

  # @return [Hash] a hash of context information to pass through to the search service
  def search_service_context
    {}
  end

  # @return [Blacklight::SuggestSearch]
  def suggestions_service
    Blacklight::SuggestSearch.new(params, search_service.repository).suggestions
  end
end

Version data entries

53 entries across 53 versions & 2 rubygems

Version Path
blacklight-7.40.0 app/controllers/concerns/blacklight/searchable.rb
blacklight-7.39.0 app/controllers/concerns/blacklight/searchable.rb
blacklight-7.38.0 app/controllers/concerns/blacklight/searchable.rb
blacklight-spotlight-3.6.0.beta8 vendor/bundle/ruby/3.2.0/gems/blacklight-7.37.0/app/controllers/concerns/blacklight/searchable.rb
blacklight-7.37.0 app/controllers/concerns/blacklight/searchable.rb
blacklight-7.36.2 app/controllers/concerns/blacklight/searchable.rb
blacklight-7.36.1 app/controllers/concerns/blacklight/searchable.rb
blacklight-7.36.0 app/controllers/concerns/blacklight/searchable.rb
blacklight-7.35.0 app/controllers/concerns/blacklight/searchable.rb
blacklight-7.34.0 app/controllers/concerns/blacklight/searchable.rb
blacklight-7.33.1 app/controllers/concerns/blacklight/searchable.rb
blacklight-7.33.0 app/controllers/concerns/blacklight/searchable.rb
blacklight-7.32.0 app/controllers/concerns/blacklight/searchable.rb
blacklight-7.31.0 app/controllers/concerns/blacklight/searchable.rb
blacklight-7.30.0 app/controllers/concerns/blacklight/searchable.rb
blacklight-7.29.0 app/controllers/concerns/blacklight/searchable.rb
blacklight-7.28.0 app/controllers/concerns/blacklight/searchable.rb
blacklight-7.27.1 app/controllers/concerns/blacklight/searchable.rb
blacklight-7.27.0 app/controllers/concerns/blacklight/searchable.rb
blacklight-7.26.1 app/controllers/concerns/blacklight/searchable.rb