Sha256: f40f6ce18df1773e6e8308cc1778bb19e8951857ee1de8f455425393472aab81

Contents?: true

Size: 614 Bytes

Versions: 41

Compression:

Stored size: 614 Bytes

Contents

# frozen_string_literal: true

module Spotlight
  # ...
  module SearchHelper
    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

    # @return [Hash] a hash of context information to pass through to the search service
    def search_service_context
      return {} unless respond_to?(:current_ability)

      { current_ability: current_ability }
    end
  end
end

Version data entries

41 entries across 41 versions & 1 rubygems

Version Path
blacklight-spotlight-3.0.0.rc3 app/controllers/concerns/spotlight/search_helper.rb