app/controllers/spotlight/searches_controller.rb in blacklight-spotlight-2.13.0 vs app/controllers/spotlight/searches_controller.rb in blacklight-spotlight-3.0.0.alpha.1
- old
+ new
@@ -11,10 +11,11 @@
before_action :create_or_load_resource, only: [:create]
load_and_authorize_resource through: :exhibit
before_action :attach_breadcrumbs, only: [:index, :edit], unless: -> { request.format.json? }
include Spotlight::Base
+ include Spotlight::SearchHelper
def create
@search.assign_attributes(search_params.except((:title unless @search.new_record?)))
@search.query_params = query_params
@@ -35,10 +36,12 @@
end
end
def autocomplete
search_params = autocomplete_params.merge(search_field: Spotlight::Engine.config.autocomplete_search_field)
- (_, document_list) = search_results(search_params)
+ (_, document_list) = search_service.search_results do |builder|
+ builder.with(search_params)
+ end
respond_to do |format|
format.json do
render json: { docs: autocomplete_json_response(document_list) }
end