Class: Compass::SearchController
- Inherits:
-
ApplicationController
- Object
- ActionController::API
- ApplicationController
- Compass::SearchController
- Includes:
- Cors
- Defined in:
- app/controllers/compass/search_controller.rb
Overview
Search controller.
Instance Method Summary collapse
Methods included from Cors
Methods inherited from ApplicationController
#authenticate, #current_context, #current_context_id, #validate_context
Instance Method Details
#index ⇒ Object
8 9 10 |
# File 'app/controllers/compass/search_controller.rb', line 8 def index render json: Compass::Search.providers end |
#show ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'app/controllers/compass/search_controller.rb', line 12 def show render json: Compass::Search.search(params[:q], params[:provider_name], current_context) rescue Compass::Search::UnknownProvider => error render status: :not_found, json: { error: error., available_providers: Compass::Search.providers.map(&:name) } rescue => error Compass.logger&.error( "[ Compass::SearchController ] #{params[:provider_name]}: #{error.class}: #{error.} | Query: #{params[:q].inspect}" ) raise end |