Sha256: a78ebc2876c2cb3347401f8de8ceaf58f6953cbda34db3d106a74273a217bc6d
Contents?: true
Size: 743 Bytes
Versions: 2
Compression:
Stored size: 743 Bytes
Contents
module Answers class SearchController < Answers::ApplicationController def index query = params[:q].strip return redirect_to answers_path if params[:q].blank? results = Question.search(query, index_name: [Question.searchkick_index.name, Answer.searchkick_index.name]) Rails.logger.info "search-request: IP:#{request.env['REMOTE_ADDR']}, params[:query]:#{query}, QUERY:#{query}, FIRST_RESULT:#{results.first.text unless results.empty?}, RESULTS_N:#{results.size}" respond_to do |format| format.json { render json: results } format.html do render locals: { results: results, query: query } end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
answers-core-0.0.0.2 | app/controllers/answers/search_controller.rb |
answers-core-0.0.0 | app/controllers/answers/search_controller.rb |